Apr 2, 2014 at 5:12pm Apr 2, 2014 at 5:12pm UTC
so what i want to do is design a program that will give me the entered grades by order , the thing is .i don't know how and i have to use a struct and a function and pointers
my idea was sort of like this :
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35
#include <iostream>
using namespace std;
struct info{
char name[20];
int grade;
};
int order(struct info a[]){
int x;
x=a->grade;
for (int i=0;i<15;i++){
if (x < a->grade){ x = a->grade;}
}
return x;
};
int main(){
struct info student[15];
for (int i=0;i<15;i++){
cout<<"/nenter the name: " ;
cin>>student[i].name;
cout<<"/nEnter the grade" ;
cin>>student[i].grade;
}
int *p;
p= order(student);
it's completely wrong and sloppy i know . but i really got stuck on what to do and how
any advice?
Last edited on Apr 2, 2014 at 8:23pm Apr 2, 2014 at 8:23pm UTC
Apr 2, 2014 at 8:47pm Apr 2, 2014 at 8:47pm UTC
Search "passing arrays as function parameters". You will find your answer.