+ 1

Solve it if you are genuis!!!! What is the output of this code? #include <iostream> using namespace std; int main(){ for(int class=0;class<5;class++) { cout<<class<<endl; } return 0;}

8th Sep 2016, 11:05 AM
Aklil Asregid
Aklil Asregid - avatar
9 Réponses
+ 4
@vikil lakkavatri class is also keyword for declaring a class, and in this context, you're not. It won't compile.
8th Sep 2016, 11:40 AM
Cohen Creber
Cohen Creber - avatar
+ 2
Compile error. You're using keyword class as a name for an int variable.
8th Sep 2016, 11:18 AM
Cohen Creber
Cohen Creber - avatar
+ 1
thank you cohen creber
8th Sep 2016, 6:06 PM
Aklil Asregid
Aklil Asregid - avatar
+ 1
zen thank u for knowing your mistake
8th Sep 2016, 6:10 PM
Aklil Asregid
Aklil Asregid - avatar
0
yes, your r8t it gives the compile error but tanz for your convenient ans @cohen creber
8th Sep 2016, 11:51 AM
vikil lakkavatri
vikil lakkavatri - avatar
0
plzz answer my question me recently posted....
8th Sep 2016, 11:53 AM
vikil lakkavatri
vikil lakkavatri - avatar
0
i ran that through a compiler and got nothing but errors
21st Sep 2016, 11:25 PM
Swyftwulf
Swyftwulf - avatar
- 1
0 1 2 3 4 Why not trying your code in Code Playground next time? Edit: Oh wait, class is a keyword of the language and can't be used as a variable name. So that was a trick question, uh.
8th Sep 2016, 1:07 PM
Zen
Zen - avatar
- 3
in above program class is name of data type int its output will b 0 1 2 3 4 5
8th Sep 2016, 11:32 AM
vikil lakkavatri
vikil lakkavatri - avatar