Can anyone tell me what this code outputs?
int main()
{
int test=10;
do
{
cout<<-test<<endl;
}
while (test->4)
return(0);
}
Just throw it in a compiler and see!
nothin
it will print an error message
while(test->4);
is wrong
Last edited on
I think you've got the code wrong. It should be:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
|
#include <iostream>
using namespace std;
int main()
{
int test=10;
do
{
cout<<-test<<endl;
}
while (test-->4); // You missed bits here
return(0);
}
|
-->
is the not very well known "tends to" operator. :p
Last edited on