Too many things wrong with it.
Too many things wrong with it.
Last edited by incognito; 03-28-2004 at 03:27 PM.
There are some real morons in this world please do not become one of them, do not become a victim of moronitis. PROGRAMMING IS THE FUTURE...THE FUTURE IS NOW!!!!!!!!!
"...The only real game I thank in the world is baseball..." --Babe Ruth
"Life is beautiful"-Don Corleone right before he died.
"The expert on anything was once a beginner" -Baseball poster I own.
Left cprog on 1-3-2005. Don't know when I am coming back. Thanks to those who helped me over the years.
Please help
There are some real morons in this world please do not become one of them, do not become a victim of moronitis. PROGRAMMING IS THE FUTURE...THE FUTURE IS NOW!!!!!!!!!
"...The only real game I thank in the world is baseball..." --Babe Ruth
"Life is beautiful"-Don Corleone right before he died.
"The expert on anything was once a beginner" -Baseball poster I own.
Left cprog on 1-3-2005. Don't know when I am coming back. Thanks to those who helped me over the years.
>Please help
I'm sure so many people could have viewed and answered your first post in less than one minute...
Your code is filled with C++isms that cause errors in C. This compiles, but I didn't test it for logic errors:
Code:#include <stdio.h> #include <stdlib.h> typedef struct Student { int x; struct Student * Next; }Student; int main() { int Choice; int Salir; Student* Head; Student* Dummy2; Student Dummy; Dummy2=(Student*)malloc(sizeof (Student) ); Head=(Student*)malloc(sizeof (Student) ); Head->Next=0; Dummy2->Next=0; Choice; Salir=0; for (;;) { printf("Que desea hacer\n"); printf("1)Insertar Estudiante\n"); printf("2)Ver Estudiantes\n"); printf("3) Salir\n"); scanf("%d",&Choice); switch (Choice) { case 1: { printf("Get Student's Age\n"); scanf("%d",&Dummy.x); if (Head->Next==0) { Head=&Dummy; } else { Dummy2=Head; while(Dummy2->Next!=NULL) { Dummy2=Dummy2->Next; } Dummy2->Next=&Dummy; printf("AGe %d",Dummy.x); } break; } case 2: { Student* TempHead; TempHead=(Student*)malloc(sizeof (Student) ); TempHead=Head; while (TempHead->Next!=NULL) { printf("head age %d",TempHead->x); TempHead=TempHead->Next; } break; } case 3: Salir=1; break; } if (Salir) break; } return 0; }
My best code is written with the delete key.