0

plz fix the bug

using namespace std; #include<iostream> class Student{ public: int id; string name; void put_details(int i,string n){ id=i; name=n; } void get_details(){ cout<<"id:"<<id; cout<<"\nname:"<<name; } }; int main{ Student s1; int s_id; string s_name; cout<<"Enter id of student: "; cin>>s_id; cout<<"Enter name of student: "; cin>>s_name; s1.put_details(s_id,s_name); s1.get_details(); }

8th Oct 2022, 5:07 PM
Sahil Kshirsagar
Sahil Kshirsagar - avatar
2 odpowiedzi
+ 3
Save code and share link for quick responses.. You should add first lines as header files. then next code or logic.. So swap first 2 lines..
8th Oct 2022, 5:11 PM
Jayakrishna 🇮🇳
+ 1
#include <iostream> using namespace std;
8th Oct 2022, 6:06 PM
coder- N