Linked_list_std_info problem
Oct 28, 2013 at 8:45pm UTC
I have this piece code.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36
#include <iostream>
#include<string>
using namespace std;
class std_info{
public :
string name;
string id;
int credit;
float cgpa;
};
int main()
{
std_info student;
cout<<"Enter student name: " ;
getline(cin, student.name);
cout<<"Enter id: " ;
getline(cin, student.id);
cout<<"Enter credit: " ;
cin>>student.credit;
cout<<"Entmer cgpa: " ;
cin>>student.cgpa;
cout<<"Nmae: " <<student.name<<endl;
cout<<"Id: " <<student.id<<endl;
cout<<"Credit: " <<student.credit<<endl;
cout<<"Cgpa: " <<student.cgpa<<endl;
system ("Pause" );
return 0;
}
Now how can I implement this in linked list? That is, instead of working with a value in linked list, I want to work with std_info() which contains name, id, credits etc.
(I have also the linked list; I just want to know the way of implementation)
Anyone can help?
Oct 28, 2013 at 10:16pm UTC
std::list< std_info > alis;
Oct 29, 2013 at 4:47am UTC
Its much straight forward bro.
Can you explain it?
Topic archived. No new replies allowed.