i store student information(name grade mark) in database....how to print student who score less than 50.0 mark and who score A ,Compute the average mark of students in the class, number of students who scored less than 50.0 marks,Print out the information for all ten students and Given a student name (input by the user), print out all the information for that student......

#include<stdio.h>
#include<stdlib.h>
#include<conio.h>
#include<string.h>
int main()
{
  int clrscr();
  int i,j;
  float tf=0;
  char t[100];
  struct student
  {
    char name[100];
    char grade[100];
    float marks;
  };
  printf("Please enter innformation of 10 student\n");
  struct student s[10];
  for(i=0;i<10;i++)
  {
  printf("\nName   :");
  scanf("%s",&s[i].name);
  printf("Grade  :");
  scanf("%s",&s[i].grade);
  printf("Mark   :");
  scanf("%f",&s[i].marks);

  }
  for(i=0;i<10;i++)
  {
    for(j=i;j<10;j++)
    {
           if(s[i].marks>s[j].marks)
           {
        tf=s[i].marks;
        s[i].marks=s[j].marks;
        s[j].marks=tf;

        strcpy(t,s[i].grade);
        strcpy(s[i].grade,s[j].grade);
        strcpy(s[j].grade,t);
        strcpy(t,s[i].name);
        strcpy(s[i].name,s[j].name);
        strcpy(s[j].name,t);
           }
    }
  }

}

void displayMenu(int &option) {
    /* display result */
   printf("\t    ****************************************************\n");
   printf("\t    ************    Welcome To My Program   ************\n");
   printf("\t    ****************************************************\n");
   printf("\nPlease choose one of the following :");
   printf("\n\n1. Display Information of All Student\n");
   printf("2. Display Information of All Student Who Scored Grade A\n");
   printf("3. Display Information of All Student Who Scored Less Than 50.0 Marks A\n");
   printf("4. Display Number of Student Who Scored Less Than 50.0 Marks \n");
   printf("5. Compute The Average Mark of Students in the Class\n");
   printf("6. Given a student name (input by the user), print out all the information for that student\n");
   printf("7. Exit this program\n");

   /* display and input selection */
   printf("\nPlease enter your selection :");
   scanf("%d%c",&option);

}

int main(){
int option =0;
bool exit = false;
while(!exit) {
displayMenu(option);/* function call */
system("cls");
switch(option) {

case 1:

break; 

case 2:

continue;

case 3:

continue;

case 4:
continue;

case 5:

continue;

case 6:

continue;

case 7:

continue;

case 8:
exit = true;
break;
default:
printf("Incorrect selection.....Please try again ! ! !\n");
continue;
}
}
return 0;/* indicates successful termination */
}

how to print student who score less than 50.0 mark and who score A... number of students who scored less than 50.0 marks,Print out the information for all ten students and Given a student name (input by the user), print out all the information for that student......

Traverse the struct array, use if statements to find students with needed mark then once found print out the rest of the information in the index

,Compute the average mark of students in the class,

use a loop to traverse the array then compute for average of the marks

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.