| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Display Modes |
|
|
|
Free Web 2.0 Code Generator! Generate data entry and reporting .NET Web apps in minutes. Quickly create visually stunning, feature-rich apps that are easy to customize and ready to deploy. Download Now!
|
|
#1
|
|||
|
|||
|
C++ Linked List Help Needed!
Hello. I am working on a Singly Linked List for a school project.
I am totally lost as to where to start. Here is the assignment: Quote:
I have read several tutorials, but they all use Classes, something I am not familiar with. Can anyone give me a hand? As basic as possiable is prefered! |
|
#2
|
|||
|
|||
|
Hey
I remember doing this... I will write the code out and post it here. kk..
:P eyepuppy :P EDit... Opps i took visual basic off... hmmm... let me reinstall :P eyepuppy :P |
|
#3
|
||||
|
||||
|
LOL - last time I checked you couldn't write C++ with Visual Basic
![]() |
|
#4
|
|||
|
|||
|
Quote:
I think he means Visual Studio. |
|
#5
|
|||
|
|||
|
like this?
Code:
#include<iostream.h>
#include<stdlib.h>
#include<string.h>
struct node{
char name[20];
float wage;
node *nxt;
};
node *head=NULL;
main(){
char s[20];
do{
cout<<"enter name: ";
cin>>s;
if(strcmp(s,"exit")!=0){
node *temp=new node;
cout<<"enter wage: ";
strcpy(temp->name,s);
cin>>temp->wage;
temp->nxt=NULL;
if(head==NULL) head=temp;
else{
node *temp2=head;
while(temp2->nxt!=NULL) temp2=temp2->nxt;
temp2->nxt=temp;
}
}
}
while(strcmp(s,"exit")!=0);
node *temp3=head;
do{
if(temp3==NULL) cout<<"end of list"<<endl;
else{
cout<<"name: "<<temp3->name<<endl;
cout<<"wage: "<<temp3->wage<<endl;
temp3=temp3->nxt;
}
}
while(temp3!=NULL);
}
if not, sorry... |
![]() |
| Viewing: Dev Articles Community Forums > Programming > C/C++ Help > C++ Linked List Help Needed! |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|