i would like to know if my code program is correct? it would be glad for me if anyone help me | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

i would like to know if my code program is correct? it would be glad for me if anyone help me

#include <stdio.h> using namespace std; int main() { string name, course; cout << "Input your name:"; cin >> name; cout << "Your course:"; cin >> course; cout << "\n\n"; return 0; }

21st Sep 2021, 11:30 AM
Christian Joseph E Marigmen
Christian Joseph E Marigmen - avatar
1 Answer
+ 1
#include<stdio.h> //this header file is included in c. No files used in this program from this header so, works here but no need here. #include <iostream> //you must include this header because for the definations of "string, cout, cin " of your program. now it works. using namespace std; int main() { string name, course; cout << "Input your name:"; cin >> name; cout << "Your course:"; cin >> course; cout << "\n\n"; //you are taking input but display inputs to check what inputs entered. like this : cout<<name<<"\n"<<course; return 0; }
21st Sep 2021, 11:50 AM
Jayakrishna 🇮🇳