Hi everybody,
Im a new member on this forum and I want ur help on C language. Im a new student on this language & mostly we study it by our-selves.
This is the question:
One of the academic staff is trying to keep track of the students and their
semester results in his class. Write a program to read the name, metric
number, and the semester average for some students in this class using
one dimension arrays. Your program should allow the user to enter the
related information about each student and show the results (in three
columns format) in such a way to relate each name with its metric
number and average.
And this is my tries:
#include <stdio.h>
main (){
char stu_name[10];
int stu_ID;
double Avg;
int c;
for(int i=0; i<10; i++){
printf ("Enter your Name");
scanf ("%s", stu_name [10]);
printf ("Enter your ID");
scanf ("%d",& stu_ID);
printf ("The Avreg is:");
scanf ("%f",& Avg);
}
for(int j=0; j<10; j++){
printf ("stu_name %s", stu_name[10]);
printf ("stu_ID %d", stu_ID);
printf ("Avg %f", Avg);
}
c=getchar();
return 0;
}
2)
#include<stdio.h>
#include<string.h>
struct st{
char* StName;
char* StID;
int mark;
};
int main(void){
struct st stArr[2];
stArr[0].StName="Ibtisam";
stArr[0].StID="2005599574";
stArr[0].mark=83;
stArr[1].StName="Ikram";
stArr[1].StID="2005599576";
stArr[1].mark=88;
int counter;
for(counter=0;counter<2;counter++){
printf("----------\nname :%s\nID :%s\nmark:%d\n-----------\n",stArr[counter].StName,stArr[counter].StID,stArr[counter].mark);
getchar();
}
}
Please I want ur help.. tomorrow I will submit it!!
A note: we r using Borland c++ 5.02
my regards..