Need help with my linklist
How do I change this code so that the user does not have to enter the name and telephone number?
I want to have 3 names and numbers ready in my code.
1 2 3 4 5 6 7 8 9 10 11 12
|
slinklist std;
std.initialize();
string name;
int tel;
cout<<"Enter name: ";
cin>> name;
cout<<"Enter telephone number: ";
cint>> tel;
std.insert_head(name, tel);
|
So you want to have 3 names and numbers without having the user enter any? well you could use an array for that right? like
string name[2]
, and then
1 2 3
|
name[0] = "John";
name[1] = "Chris";
//and so on...
|
same goes with the tel numbers.
Last edited on
Topic archived. No new replies allowed.