Ask your own question, for FREE!
Computer Science 18 Online
OpenStudy (maram):

Write a program that uses following structured memory: struct info { char lastName[80]; char firstName[80]; char ID[20]; int score; }; to store the information of five students. You program should allow a user to enter the information of those students. Write a function in this program that has no return value, and receives a student ID number as its input. The function will search for the student that has the ID number that matches the input. If such student is found, then display all the information about this student, otherwise, display the message: The student is not f

OpenStudy (maram):

The student is not found! Such function should have three inputs: an array that stores the information about the students; the size of the array; the student ID number (it should be an character array). Hint: the header of the function should look like following: void searchEngine(info a[],int length,char[]);

OpenStudy (maram):

There is some mistake but I don't know where it. can you help me //strcpy(a,b) [b into a] //dummy=cin.getchar(); //strcmp(a, b) [if a>b, +; if a<b; -; if a=b, 0] #include<iostream> using namespace std; int main() { char a[30]={0}, b[30]={0}, c[30]={0}, d[30]={0}, t[30]={0}; cout<< "Please enter your name so I could put it in order from A-Z (30 character limit):"; cin.getline(a, 30); cout<< "Please enter your name so I could put it in order from A-Z (30 character limit):"; cin.getline(b, 30); //just thought of how doing a for loop would be easier for(int i=0;i<3;i++){ cout<< "Please enter your name so I could put it in order from A-Z (30 character limit):"; if(i==1) cin.getline(c, 30); if(i==2) cin.getline(d, 30); } for(int z=0;z<5;z++){ if(strcmp(a,b) > 0){ //switch a with b strcpy(t,b); strcpy(b,a); strcpy(a,t); } if(strcmp(b,c) > 0){ //switch b with c strcpy(t,c); strcpy(c,b); strcpy(b,t); } if(strcmp(c,d) > 0){ //switch c with d strcpy(t,d); strcpy(d,c); strcpy(c,t); } } cout<< "a=" <<a<<endl<<"b="<<b<<endl<<"c="<<c<<endl<<"d="<<d<<endl; } /* if(strcmp(a,b) > 0){ //switch a with b strcpy(t,b); strcpy(b,a); strcpy(a,t); } if(strcmp(a,c) > 0){ //switch a with c strcpy(t,c); strcpy(c,a); strcpy(a,t); } if(strcmp(a,d) > 0){ //switch a with d strcpy(t,d); strcpy(d,a); strcpy(a,t); } if(strcmp(b,c) > 0){ //switch b with c strcpy(t,c); strcpy(c,b); strcpy(b,t); } if(strcmp(b,d) > 0){ //switch b with d strcpy(t,d); strcpy(d,b); strcpy(b,t); } if(strcmp(c,d) > 0){ //switch c with d strcpy(t,d); strcpy(d,c); strcpy(c,t); } if(strcmp(c,b) < 0) //c<d if(strcmp(b,d) < 0) //b<d if(strcmp(b,c) < 0) //b<c if(strcmp(a,d) < 0) //a<d if(strcmp(a,c) < 0) //a<c if(strcmp(a,b) < 0) //a<b */

Can't find your answer? Make a FREE account and ask your own questions, OR help others and earn volunteer hours!

Join our real-time social learning platform and learn together with your friends!
Can't find your answer? Make a FREE account and ask your own questions, OR help others and earn volunteer hours!

Join our real-time social learning platform and learn together with your friends!