asked on
ASKER
ASKER
while(score != -1)
{
cout << "Next score (-1 to stop):";
cin >> score;
if(score>=100)
{
cout<<"Is the score correct?"<<endl;
cin>>confirm;
if(confirm == yes)
{
totalPoints +=score;
}
}
else
{
cout<<"score not added"<<endl;
}
cout << "Next score (-1 to stop):";
cin >> score;
}
ASKER
ASKER
// test.cpp : Defines the entry point for the console application.
//
#include "stdafx.h"
#include <iostream>
using namespace std;
int main()
{
int score = 0;
char confirm = 'y';
char yes = 'y';
int totalPoints = 0;
char grade = ' ';
cout << "First score (-1 to stop):";
cin >> score;
while(score != -1)
{
if(score>=100)
{
cout<<"Is the score correct?"<<endl;
cin>>confirm;
if(confirm == yes)
{
totalPoints +=score;
}
else
{
cout<<"score not added"<<endl;
}
}
else
{
totalPoints +=score;
}
cout << "Next score (-1 to stop):";
cin >> score;
}
if(totalPoints >=315)
grade = 'A';
else if(totalPoints >= 280)
grade = 'B';
else if(totalPoints >=245)
grade = 'C';
else if(totalPoints >=210)
grade = 'D';
else
grade = 'F';
cout << "Total Points earned:" << totalPoints << endl;
cout << "Grade:" << grade << endl;
system("pause");
return 0;
}
ASKER
Programming includes both the specifics of the language you’re using, like Visual Basic, .NET, Java and others, but also the best practices in user experience and interfaces and the management of projects, version control and development. Other programming topics are related to web and cloud development and system and hardware programming.
TRUSTED BY
It's been years since I did c++/c hoping there shouldnt be any syntax errors
Cheers!
Open in new window