1 Replies - 379 Views - Last Post: 21 February 2011 - 06:28 AM Rate Topic: -----

#1 greg12345  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 4
  • Joined: 10-February 11

Is My Program Correct?

Posted 21 February 2011 - 06:04 AM

This is the question; Make a C program that will contain structure cs12 with members - name, id num, quizgrade, labgrade,examgrade,finalgrade. Just make a fictional list of 5 records.use array of structure here.ask the user to enter the values except final grade which you will compute using 35% quizzes, 35% lab, 30% exam. Output the 5 names together with their finalgrade.

this is my code so far:

struct stuCS12{
char name[50];
int ID NO.;
float quizgrade;
float labgrade;
float finalgrade;
float examgrade;
typedef stuCS12,student1,student2,student3,stude…

int main(){
student1 n1;
printf("Enter a student name:");

printf("Enter ID NO.: ");
scanf("%d",&ID NO.);
printf("Enter quizgrade;");
printf("Enter labgrade;");
printf("Enter examgrade;");

is this correct or wrong?

Is This A Good Question/Topic? 0
  • +

Replies To: Is My Program Correct?

#2 JackOfAllTrades  Icon User is offline

  • Saucy!
  • member icon

Reputation: 6246
  • View blog
  • Posts: 24,014
  • Joined: 23-August 08

Re: Is My Program Correct?

Posted 21 February 2011 - 06:28 AM

Please do not use titles like "Plz. Help". We KNOW you're looking for help, it's WHY you posted! Give topics a descriptive title.

It's wrong, but I think you already know that because this reads like a homework question in which you're to fix the mistakes.

For one thing you're using gets(). You should NEVER use gets(). Read me

Can you have spaces or periods in a variable name?
What are the appropriate format specifiers for scanf?
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1