The text below is selected, press Ctrl+C to copy to your clipboard. (⌘+C on Mac) No line numbers will be copied.
Guest
Structure complitedand function
By Guest on 16th January 2023 02:29:56 PM | Syntax: TEXT | Views: 5



New paste | Download | Show/Hide line no. | Copy text to clipboard
  1. #include<iostream>
  2. using namespace std;
  3. char calculategarde(int mark);
  4. struct student
  5. {
  6.         string name;
  7.         int mark;
  8.         char gender;
  9.         float weight;
  10. };
  11. int main()
  12. {
  13.         student temari[5];
  14.         cout<<"enter the student info "<<endl;
  15.         for(int i=0;i<=3;i++)
  16.         {
  17.                 cin>>temari[i].name;
  18.                 cin>>temari[i].mark;
  19.         }
  20.         cout<<"the info of the students is "<<endl;
  21.         for(int i=0;i<=3;i++)
  22.         {
  23.                 cout<<temari[i].name<<"\t";
  24.                 cout<<temari[i].mark<<"\t";
  25.                 cout<<calculategarde(temari[i].mark)<<endl;
  26.                
  27.         }
  28.         return 0;
  29. }
  30. char calculategarde(int mark)
  31. {
  32.         if(mark>=80)
  33.         return 'A';
  34.         else if(mark>=65)
  35.         return 'B';
  36.         else if(mark>=50)
  37.         return 'c';
  38.         else
  39.         return 'F';
  40. }



  • Recent Pastes
  • Questions
    14 hours 32 mins 57 secs ago
  • Adrs
    14 hours 38 mins 7 secs ago
  • Docs
    14 hours 38 mins 51 secs ago
  • Servs
    14 hours 39 mins 34 secs ago
  • Srvs
    14 hours 44 mins 23 secs ago