0
explain for syntax used by clion for c++
e.g: for hello: #include <iostream> int main(){ std:: cout <<"hello"<<std::endl; return 0; } l am confused with ds syntax diff from what l learnt
6 Answers
0
On the top is #include - include libraries.
The most important thing is function called main() of type int. It's 'commands' is closed in brackets {}. There is program starts. If everything worked fine then it return 0.
0
ok bt if common syntax to print hello it gives error...This is where my problem is
0
In c++ there are 2 top ideas to print something.
The first one std: :cout and it looks like you wrote. The second one is printf and it looks like:
printf("I'm writing %d\n", int(5));
You have to know %- in the second idea. Different % for different type of variable.
0
ok thank you
0
Maybe you should do
#include <iostream>
using namespace std;
int main(){
cout <<"hello"<<endl;
return 0;
}
0
using namespace std when there are just 2 times you call something from namespace std? No need for using namespace std here.