this is the previous code quest 1 this my question. I hope you can help LTE.id 2
ID: 3591723 • Letter: T
Question
this is the previous code quest 1
this my question. I hope you can help
Explanation / Answer
Please go threw code it will work according to your assignment .
#include <iostream>
#include <stdlib.h>
using namespace std;
#define ASSI 10
int main()
{
int ns,i=0,j=0,total =0,points,gread[30][10];
float Avg;
string students[30];
string name;
int assiNo =0;
int assiGread =0;
char ch;
string AssiName;
cout <<"Enter Assignment name"<<endl;
cin >> AssiName;
do // loop up to user want
{
cout<<"Enter the number pf students in the class:";
cin >> ns;
cin.ignore(256,' ');
for(i=0;i<ns;i++) // students loop
{
cout<<"Please enter name of student"<<endl;
cin>>students[i];
cin.ignore(256,' '); // for ignor
cout << "Please enter greads for 10 assignments"<<endl;
for(j=0;j<ASSI;j++)
{
cin >> gread[i][j]; //enter gread
cin.ignore(256,' ');
}
}
system("clear"); // clear system
while(i++ < 50) // put border
cout <<"=";
cout<<endl;
i =0;
cout <<" " <<AssiName << endl;
i = 0;
while(i++ < 50)
cout <<"=";
cout<<endl;
for(i=0;i<ns;i++) // display details
{
Avg = 0;
total = 0 ;
cout << students[i];
for(j=0;j<ASSI;j++)
{
cout <<" "<<gread[i][j];
total = total + gread[i][j];
}
Avg = total/ASSI;
if(Avg > 70)
{
cout << "There is no curve." << endl;
}
else
{
cout << "You need to had 5 points."<<endl;
}
}
cout<< "Want to change student gread ? yes - y/Y no - n/N " << endl;
cin>>ch;
if(ch == 'y' || ch == 'Y') // want to change entry?
{
cin.ignore(256,' ');
cout << "Enter student name"<<endl;
cin>>name;
while(!name.compare(students[i]))
i++;
if(i> ns)
cout << "No any student found"<<endl;
else
{
cin.ignore(256,' ');
cout << "Enter assignment no"<<endl;;
cin >> assiNo;
cin.ignore(256,' ');
cout << " Enter gread of assignment";
cin >> assiGread;
cin.ignore(256,' ');
}
gread[i-1][assiNo-1] = assiGread;
cout<<students[i-1];
total = 0;
Avg =0;
for(j=0;j<ASSI;j++)
{
cout <<" "<<gread[i-1][j];
total = total + gread[i-1][j];
}
Avg = total/ASSI;
if(Avg > 70)
{
cout << "There is no curve." << endl;
}
else
{
cout << "You need to had 5 points."<<endl;
}
}
cout<< "Want to exit ? yes - y/Y no - n/N " << endl; // want to exit or continue?
cin>>ch;
}while(ch != 'y' || ch != 'Y');
return 0;
}
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.