0
#include <stdio.h>
#include <string.h>

struct courses{

       char coursenumber[10];
       float credit;
       float grade;
};

struct courses list[2];

main()
{

int i;
int count;

     printf("Enter number of courses to input: ");
     scanf("%d", &count);
     
for (i=0; i<2; i++)
{
     printf("Course number: ");
		 scanf("%s", list[i].coursenumber );
     printf("Credit: ");
		 scanf("%f", list[i].credit);
     printf("Grade: ");
		 scanf("%f", list[i].grade);
}  
     
     printf("\n\n");

		 for (i=0; i<2; i++)
     {
		 printf("%s", list[i].coursenumber);
         printf("%f", list[i].credit);
         printf("%f", list[i].grade);
}
     return 0;

}
2
Contributors
3
Replies
4
Views
9 Years
Discussion Span
Last Post by Aia
0

What's your question?.

Post what is this program suppose to do. What kind of malfuntions it
has, what copiling errors you recieve, etc, etc,...

0

What's your question?.

Post what is this program suppose to do. What kind of malfuntions it
has, what copiling errors you recieve, etc, etc,...

this program has to gather all the subjects, grades and credits of the students. and be able to display it in columnized.

when i compile it... it compiles but when i run it in cmd... while entering the info it will stack and porst error messae like (dont send)....

0

when i compile it... it compiles but when i run it in cmd... while entering the info it will stack and porst error messae like (dont send)....

You are forgetting to write the & operator in all the scanf() that are not strings.
Example:
scanf("%f", &list.credit); needs it. Any thing that is not
printf("%s", list.coursenumber);

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.