Run Code
|
API
|
Code Wall
|
Misc
|
Feedback
|
Login
|
Theme
|
Privacy
|
Patreon
Project 5 v.05
//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 printall(record records[10],int N){ for(int i=0;i<N;i++){ 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(void) { 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); }
run
|
edit
|
history
|
help
0
Class Friday 1/20 Inauguration Day
PtStrCpy
8 trajo semal 4
menu
Assignment 5 v2
day 2
Michael Bean's Spring 2017 Lab 3 v1
Función quicksort para strings
Bitwise Operations
C_141105_PuntosTriangulo