#include<iostream>
#include<windows.h>
using namespace std;
int main()
{
int tempTest = -1;
int testCount, testAverage;
string name1,name2,name3,name4;
cout << "\n - Enter the Students name: ";
cin >> name1>> name2 >> name3 >> name3;
system("cls");
do {
cout << "Enter the number of test scores to average (up to 100): ";
cin >> testCount;
if (testCount < 1 || testCount > 100)
cout << "INVALID! Number must be between 1 and 100." << endl << endl;
} while (testCount < 1 || testCount > 100);
cout << endl;
for (int i = 1; i <= testCount; i++)
{
do {
cout <<"Input test score " << i << ": " << name1 << " "
<< i << ": " << name2 << " "
<< i << ": " << name3 << " ";
cin >> tempTest;
if (tempTest < 0 || tempTest > 100)
cout << "INVALID! Number must be between 0 and 100." << endl << endl;
} while (tempTest < 0 || tempTest > 100);
@Softrix I did his program in my computer, even created those classes I would use if could not #include. I could help him, but, come on, what you said to me was really more necessary.
Calling someone a noob because he doesn't know how to do something is normal behaviour? - everyone has to start somewhere, and you were there once remember? - so don't be so harsh with people and just offer some advice, which is the WHOLE point of this forum isn't it?
Noob = newbie. His programs do what he wants, he only must join them. I was going to reply him, but I had no time. Eg.: I'm typing from a smartphone. I said "I don't like to be rude" because I know what would be the reaction. So there we are.
The Beginners forum is by definition going to have questions from newbies/noobs looking for guidance. If you don't have the time or inclination to help, you can just leave the post for someone else who does.
@ iQChange So if you didn't have anything constructive to add then you shouldn't have even posted. I'm not going to go through an endless debate here so just leave it.
I can only assume your replying with childish comments to increase your post count because other than that, they are pointless.
You talk rubbish, "I don't like to be rude, but you're a noob. Come on, you can do it better!" doesn't look to me like you were planning to help, unless my English is not as good as yours...
I see someone has reported your post, its clear I am not the only one who thinks your attitude sucks, now grow up and learn to behave on the forum.
Oh @Softrix, what can you talk about me? I grew up since a long time. Can you understand I was going to reply? I just had no time!
So please, stop sayin' I'm a "child" or I can't behave in this simple forum. Come on guy, please, don't be a pain in the @ss.
Like you, I'm leaving now. Hope we don't have further misunderstoods.
May I ask why you posted a bunch of arbitrary programs with the one you wanted help with? You should only post relevant information in the future; it will make it easier to help.
TESTSCORE
//Jabat, Kiana SKye
//COE113L-A5-17
//TestScore.cpp
#include <iostream>
usingnamespace std;
int main()
{
int testScore1, testScore2, testScore3, testScore4, name; //a name is a string of characters not an integer
//you should make it a std::string or if you have not learned yet
//a character array (c-string)
double average;
//you should also initialize all of those variables declared
cout << "Enter names: " <<endl;
cin>>names
cout<<"Enter test score 1: ";
cin >> testScore1;
cout << "Enter test score 2:";
cin >> testScore2;
cout << "Enter test score 3:";
cin >> testScore3;
average = (testScore1 + testScore2 + testScore3)/3;
cout << "Your total average is: " << average << endl;
return 0;
}
To wrap it in a do/while loop you will need a new variable for the conditions. Something like:
1 2 3 4 5 6 7
char repeat = 'y'; //since it is initialized we could honestly use a while loop
//and would be safe that it runs at least once
do
{
//stuff to repeat
} while(repeat == 'y' || repeat == 'Y'); //condition
You also seem to have used the do/while loop a few other times in your programs shouldn't be too trivial to incorporate it into the one you want it in.[/edit]