I'm trying to write a C++ that involves a loop but it not working right?

I'm trying to write a C++ program that will allow a user to input a number from the keyboard. Then using a loop, that will perform 10 times, multiply the entered number by the loop counter. Print out the loop counter, the entered number and the product of the loop counter and the entered number. A one-time heading should be displayed before information is printed.

This kinda of what I have so far:

#include <iosteam>
using namespace std;
int main ()
{
Start
Declare: numScores, sum, score, avg, SENTINEL = 200
numScores = 0
Do
Write "Enter your score, or 200 to quit: "
Read score
While score < 0
Write "There are no negative scores!"
Write "Enter another: "
Read score
End While
If score != SENTINEL Then
numScores = numScores + 1
sum = sum + score
End If
While score != SENTINEL
If numScores != 0 Then
avg = sum/numScores
Write "Average = ",avg
Else
Write "No valid scores were input."
End If
Stop
}

All the programs I have tried to make are not working any suggestions?
Is this pseudocode of the steps you want to do? Just wondering because the heading is C++ but the rest of it isn't. (small typo at top <iostream> not <iosteam>)
Are you confusing C++ with Visual Basic or something?
I would go back through the tutorial and read starting from the beginning:
http://www.cplusplus.com/doc/tutorial/
No it's a C++ program that I'm trying to create, I realize that I kind of wrote this in the wrong section. I'm a beginner... I was just trying to find the different programs to help me with this one, and yes that is pseudocode...
In that case, let me help you out:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
//#include <iosteam>
#include <iostream> // Fixed typo
//using namespace std; // Not recommended
int main ()
{
    //Start
    //Declare: numScores, sum, score, avg, SENTINEL = 200
    int numScores, sum = 0, score;
    double avg;
    const int SENTINEL = 200;
    numScores = 0;

    //Do
    do
    {
        //Write "Enter your score, or 200 to quit: "
        std::cout << "Enter your score, or 200 to quit: ";
        //Read score
        std::cin >> score;
        //While score < 0
        while (score < 0)
        {
            //Write "There are no negative scores!"
            std::cout << "There are no negative scores!";
            //Write "Enter another: "
            std::cout << "Enter another: ";
            //Read score
            std::cin >> score;
        //End While
        }
        //If score != SENTINEL Then
        if (score != SENTINEL)
        {
            numScores = numScores + 1;
            sum = sum + score;
        //End If
        }
    //While score != SENTINEL
    } while (score != SENTINEL);
    //If numScores != 0 Then
    if (numScores != 0)
    {
        //avg = sum/numScores
        avg = static_cast<double>(sum) / numScores;
        //Write "Average = ",avg
        std::cout << "Average = " << avg;
    }
    //Else
    else
        //Write "No valid scores were input."
        std::cout << "No valid scores were input.";
    //End If
    //Stop
    return 0; // Optional
}
Topic archived. No new replies allowed.