#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;

}

Recommended Answers

All 3 Replies

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,...

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)....

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);

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.