Run Code
|
API
|
Code Wall
|
Misc
|
Feedback
|
Login
|
Theme
|
Privacy
|
Patreon
Project v0.07
//gcc 5.4.0 #include <stdio.h> #include <string.h> typedef struct{ char firstname[20]; char lastname[20]; }name; typedef struct{ int student_ID; name studentname; char Grade; char Major[10]; }record; //int printone(record records[],int N){ // printf("Please input # from 0-%d",N); // int i=0; // scanf("%d",&i); // printf("Student ID #: %d\n",records[i].student_ID); // printf("Name: %s %s\n",records[i].studentname.firstname,records[i].studentname.lastname); // printf("Grade: %c\n",records[i].Grade); // printf("Major: %s\n",records[i].Major); // } int printall(record records[],int N){ printf("Hi\n"); int i=0; //for(i=0;i<N;i++){ printf("Student ID #: %d\n",records[i].student_ID); //printf("Name: %s %s\n",records[i].studentname.firstname,records[i].studentname.lastname); //printf("Grade: %c\n",records[i].Grade); //printf("Major: %s\n",records[i].Major); // } //return 0; } //int printCS(record records[],int N){ // int i; // for(i=0;i<N;i++){ // if(records[i].Major=="CS") // printf("Student %d\nName: %s %s\nGrade: %c\nMajor: %s\n",records[i].student_ID,records[i].studentname.firstname,records[i].studentname.lastname,records[i].Grade,records[i].Major); // } // } //int printECO(record records[],int N){ // int i; // for(i=0;i<N;i++){ // if(records[i].Major=="Eco") // printf("Student %d\nName: %s %s\nGrade: %c\nMajor: %s\n",records[i].student_ID,records[i].studentname.firstname,records[i].studentname.lastname,records[i].Grade,records[i].Major); // } // } //int printGrade(record records[],int N){ // printf("Please input LetterGrade"); // char Gradecheck; // scanf("%c",&Gradecheck); // int i; // for(i=0;i<N;i++){ // if(records[i].Grade==Gradecheck) // printf("Student %d\nName: %s %s\nGrade: %c\nMajor: %s\n",records[i].student_ID,records[i].studentname.firstname,records[i].studentname.lastname,records[i].Grade,records[i].Major); // } // } //int printID(record records[], int N){ // printf("Please input Student's ID #\n"); // int id=0; // int i=0; // scanf("%d",&id); // for(i=0;i<N;i++){ // if(records[i].student_ID==id) // break; // } // printf("Student %d\nName: %s %s\nGrade: %c\nMajor: %s\n",records[i].student_ID,records[i].studentname.firstname,records[i].studentname.lastname,records[i].Grade,records[i].Major); // return(0); // } int main() { int N=10; record records[N]; records[0].student_ID=1001; strcpy(records[0].studentname.firstname,"Clock"); strcpy(records[0].studentname.lastname,"Explosion"); strcpy(records[0].Grade,"A"); strcpy(records[0].Major,"CS"); records[1].student_ID=1002; strcpy(records[1].studentname.firstname,"Van"); strcpy(records[1].studentname.lastname,"Gogh"); strcpy(records[1].Grade,"C"); strcpy(records[1].Major,"EE"); records[2].student_ID=1003; strcpy(records[2].studentname.firstname,"Paul"); strcpy(records[2].studentname.lastname,"Michelangelo"); strcpy(records[2].Grade,"B"); strcpy(records[2].Major,"Stat"); records[3].student_ID=1004; strcpy(records[3].studentname.firstname,"Salvador"); strcpy(records[3].studentname.lastname,"Dali"); strcpy(records[3].Grade,"D"); strcpy(records[3].Major,"Eco"); records[4].student_ID=1005; strcpy(records[4].studentname.firstname,"William"); strcpy(records[4].studentname.lastname,"Joe"); strcpy(records[4].Grade,"B"); strcpy(records[4].Major,"Eco"); records[5].student_ID=1006; strcpy(records[5].studentname.firstname,"Mary"); strcpy(records[5].studentname.lastname,"Raphael"); strcpy(records[5].Grade,"C"); strcpy(records[5].Major,"Math"); records[6].student_ID=1007; strcpy(records[6].studentname.firstname,"John"); strcpy(records[6].studentname.lastname,"Scher"); strcpy(records[6].Grade,"A"); strcpy(records[6].Major,"Mec"); records[7].student_ID=1008; strcpy(records[7].studentname.firstname,"Rahul"); strcpy(records[7].studentname.lastname,"Patel"); strcpy(records[7].Grade,"B"); strcpy(records[7].Major,"Eco"); records[8].student_ID=1009; strcpy(records[8].studentname.firstname,"Claude"); strcpy(records[8].studentname.lastname,"Monet"); strcpy(records[8].Grade,"C"); strcpy(records[8].Major,"CS"); records[9].student_ID=1010; strcpy(records[9].studentname.firstname,"Gustav"); strcpy(records[9].studentname.lastname,"Klimt"); strcpy(records[9].Grade,"A"); strcpy(records[9].Major,"CS"); printall(records,N); //printf("HI"); //printone(records,N) }
run
|
edit
|
history
|
help
0
Lab 10 v1
printing numbers without using loop
ele709 3.5 finished
selection sort
300
HeapSort
printing float 3 pointers
ptr[]
first C code
2