samedi 31 octobre 2015

Write a program that prompts the user for a collection of integers

Write a program that prompts the user for a collection of integers and displays the product of those integers. Your program should repeatedly prompt for, read data, ignore any negative numbers and terminate when a zero value is read.

here's what i did so far , Please help me to finish the rest of the code

#include <iostream>

using namespace std;

int main() {
    int Num;
    double product = 0;
    int integerNumber;
    int countNumber = 0;
    cout << "Please enter the number of student = ";
    cin >> Num;
    while (Num>countNumber)
    {
        cout << "Please enter the integer = ";
        cin >> integerNumber;
        product = product + integerNumber;
        countNumber = countNumber + 1;
    }
    cout << "The avarage Grade of all students is = " << product << endl;

    system("pause");
    return 0;
}

Aucun commentaire:

Enregistrer un commentaire