+ 6

Something Witty

Write a program in c++ that outputs a statement but does not has a ';' at the end of it. Like int a=10; cout<<a<<"Something" But it should work on compiler.

12th Nov 2016, 11:54 AM
Megatron
Megatron - avatar
6 Answers
+ 6
Well Rahul Chittimalla got it.
12th Nov 2016, 2:41 PM
Megatron
Megatron - avatar
+ 2
You can use #include <iostream> using namespace std; int main() { int a=10; if(cout<<a<<" Something" ) return 0; }
12th Nov 2016, 1:08 PM
Aditya kumar pandey
Aditya kumar pandey - avatar
+ 2
Nice Aditya Kumar Pandey I know one more method but its a fooling one. Try to get it to OR I shall post it here.
12th Nov 2016, 2:10 PM
Megatron
Megatron - avatar
+ 1
yup.. sir i am waiting for your answer.
12th Nov 2016, 2:11 PM
Aditya kumar pandey
Aditya kumar pandey - avatar
+ 1
#include <iostream> using namespace std; #define s ; int main() { int a = 10; cout<<a<<" something" s return 0; }
12th Nov 2016, 2:28 PM
Rahul Chittimalla
Rahul Chittimalla - avatar
+ 1
ok sir, Thank you
12th Nov 2016, 2:43 PM
Aditya kumar pandey
Aditya kumar pandey - avatar