Computer Science, asked by nithyasri647, 19 days ago

write a c++ program to get input from user student number,name, mark in all subject. find total ,average ,grade using setw and set fill​

Answers

Answered by jlaymra
1

Answer:

#include <iostream>

using namespace std;

struct student

{

char name[50];

int roll;

float marks;

};

int main()

{

student s;

cout << "Enter information," << endl;

cout << "Enter name: ";

cin >> s.name;

cout << "Enter roll number: ";

cin >> s.roll;

cout << "Enter marks: ";

cin >> s.marks;

cout << "\nDisplaying Information," << endl;

cout << "Name: " << s.name << endl;

cout << "Roll: " << s.roll << endl;

cout << "Marks: " << s.marks << endl;

return 0;

}

hope it's helpful.

Answered by samarthkrv
1

Answer:

#include <iostream>

using namespace std;

int

main ()

{

 char name[150];

 int rn, sc , x;

 double avg , percentage;

   cout << "Enter stuudent name:";

   cin >> name;

   cout << "Enter number of subjects:";

   cin >> sc;

   cout << "Enter marks for each subject:";

   cin >> x;

   double grades[sc];

       for(int i = 0; i < sc; i++){

           cout << "Enter marks of subject " << (i+1) << ":";

           cin >> grades[i];

       }

       int total = 0;

       for(int i = 0; i < sc; i++){

           total = total + grades[i];

       }

       double total1 = x*sc;

       avg = (double)(total / sc);

       percentage = (double)(total/total1)*100;

       cout << "The total is " << total << endl;

       cout << "The average is " << avg << endl;

       cout << "The percentage is " << percentage << endl;

}

Explanation:

Similar questions