What's the issue with this? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

What's the issue with this?

It is not working... I don't get it... Help in comments...

20th May 2017, 3:19 PM
Leto Zdairstek
5 Answers
+ 15
Your program has to be inside main(), because main() is where your program begins to run. Code Playground loads the default code template, and you have to place your statements inside main() instead of below it. #include <iostream> using namespace std; int main() { string name; cout << "Hello. I am C++. Who are you?\n"; cin >> name; cout << "Hello " << name; return 0; } Few more points to take note: • Differentiate between << and >> operators - cout << something; - cin >> something; • Use correct datatypes for variable declaration - int for integers - char for single characters - string for a collection of chars • Enforce indentations wherever needed
21st May 2017, 2:11 AM
Hatsy Rei
Hatsy Rei - avatar
+ 7
#include <iostream> using namespace std; int main() { return 0; } { cout>>"Hello. I am C++. Who are you?\n"; int name; cin>>name; cout>>"Hello,"; cout>>name; } His code is like this....Ummm....I can't explain the error -_- *Headache*
20th May 2017, 5:25 PM
Yanothai Chaitawat
Yanothai Chaitawat - avatar
+ 4
#include <iostream> using namespace std; int main() { cout<<"Hello. I am C++. Who are you?"; char name; cin>>name; cout<<"Hello," <<name; } how abt this?
20th May 2017, 11:58 PM
Zikry Abdul Wafi
Zikry Abdul Wafi - avatar
+ 3
int name??
20th May 2017, 10:00 PM
Gustave A C/D C ☢️ 🛸♨️🛸🛸
+ 1
if the code is what is in the tags, there is a missing } at the end. but i cannot see how this can be related to loops. there is none in this program.
20th May 2017, 3:26 PM
Testing002