| | |
What is do?
Please support our C++ advertiser: Intel Parallel Studio Home
![]() |
•
•
Join Date: Dec 2008
Posts: 14
Reputation:
Solved Threads: 0
26. What is printed in the following code segment?
a) 50
b) 51
c) 75
d) 76
I = 1;
do
{
I = I + 25;
}
while ( I > 50 );
cout << I + 50;b) 51
c) 75
d) 76
do is the top of a loop
I'm not going to answer the question you posted -- write a small test program and see for yourself what the answer is. Just post that code in a main() function and you have it done.
C++ Syntax (Toggle Plain Text)
do { // something here } while ( <some condition here that stops the loop> );
I'm not going to answer the question you posted -- write a small test program and see for yourself what the answer is. Just post that code in a main() function and you have it done.
Last edited by Ancient Dragon; Dec 9th, 2008 at 2:29 am.
Don't PM me with questions -- you might get a nasty PM in response. If you have a question then post it in one of the forums.
23 http://www.daniweb.com/forums/thread161397.html
14 http://www.daniweb.com/forums/thread161389.html
Is this a live feed direct from my keyboard to your answer sheet without going through YOUR mind?
14 http://www.daniweb.com/forums/thread161389.html
Is this a live feed direct from my keyboard to your answer sheet without going through YOUR mind?
•
•
Join Date: Nov 2008
Posts: 23
Reputation:
Solved Threads: 2
; it will print out "76"
; do means an action will happen and then it will check if the while ;statement is true, if so again it will go to do or else it will exit from ;do while loop
I = I + 25; // it will add 25 to I
while ( I > 50 ); // then it will check if I is more than 50, if so it will again add 25 to I
else
it will print I out.
; do means an action will happen and then it will check if the while ;statement is true, if so again it will go to do or else it will exit from ;do while loop
I = I + 25; // it will add 25 to I
while ( I > 50 ); // then it will check if I is more than 50, if so it will again add 25 to I
else
it will print I out.
Practice problems mean you type them into your compiler, compile them, and see how they work. That's the best way to figure out how things work. For these, forget the internet -- pretend it doesn't exist. All you have is you, your computer, and your compiler.
Last edited by Ancient Dragon; Dec 9th, 2008 at 2:52 am.
Don't PM me with questions -- you might get a nasty PM in response. If you have a question then post it in one of the forums.
![]() |
Other Threads in the C++ Forum
- Previous Thread: pointersq
- Next Thread: Can someone tell me if I did these links correctly?
| Thread Tools | Search this Thread |
api application array arrays based beginner binary bitmap c++ c/c++ calculator char char* class classes code coding compile compiler console conversion convert count data database delete deploy developer dll dynamiccharacterarray email encryption error file format forms fstream function functions game generator getline graph homeworkhelper iamthwee ifstream image input int java lib list loop looping loops map math matrix memory multidimensional multiple newbie news node number numbertoword output parameter pointer problem program programming project proxy python random read recursion recursive reference rpg simple sorting string strings template text tree url variable vector video visual visualstudio win32 windows winsock word wordfrequency wxwidgets






