Click here to Skip to main content
15,889,116 members
Articles / Programming Languages / C++
Alternative
Tip/Trick

Amusing C++: funny tricks

Rate me:
Please Sign up or sign in to vote.
3.00/5 (2 votes)
1 Nov 2011CPOL 12.8K   1   6
Try this one://Can we print all integers from 1 to 30??/int x = 0;while (x < 30){ _tprintf(_T("X = %d\n"), ++x);}

Try this one:


C#
//Can we print all integers from 1 to 30??/
int x = 0;
while (x < 30)
{
  _tprintf(_T("X = %d\n"), ++x);
}

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



Comments and Discussions

 
QuestionMy vote of 5 Pin
Manikandan106-Jun-14 20:48
professionalManikandan106-Jun-14 20:48 
GeneralReason for my vote of 1 for being a noob Pin
mier10-Nov-11 5:46
mier10-Nov-11 5:46 
GeneralRe: Go look for a life somewhere else Pin
User 4041110-Nov-11 17:38
User 4041110-Nov-11 17:38 
GeneralYep, should have been _tprintf, been busy with safe string c... Pin
User 4041131-Oct-11 21:17
User 4041131-Oct-11 21:17 
GeneralRe: Oh you meant the comment! I deleted that when I tried it. I ... Pin
Indivara31-Oct-11 22:28
professionalIndivara31-Oct-11 22:28 
GeneralI suppose you meant to write _tprintf? (there's no _tsprintf... Pin
Indivara31-Oct-11 20:53
professionalIndivara31-Oct-11 20:53 
I suppose you meant to write _tprintf? (there's no _tsprintf and _stprintf makes no sense here)
What is it supposed to do?

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.