Home Forums C Programming beginners needs help Re: Re: beginners needs help

#3616
GWILouisaxwzkla
Participant

could try:



/****************************************************************
* File Name : c:programstempCG.cpp
* Date : December,29,2009
* Comments : new project
* Compiler/Assembler : Visual C++ 6.0
* Modifications :
*
*
*
*
*
* Program Shell Generated At: 11:37:28 a.m.
=-=-=-=-=-=-=-=--=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/


#include < iostream >
//#include < string.h >
//#include < conio.h >
//#include < math.h >
//#include < iomanip >
//#include < ctype.h >

using namespace std;

//main function ******************************

int main ( )
{

int input;
int numberOfInputItems;
int numberCount = 0;

cout << "Enter number of items to input: ";
cin >> numberOfInputItems;

int i = 0;
while ( i < numberOfInputItems )
{
cout << "enter a number: ";
cin >> input;
if ( input == 1 || input == 4 || input == 5 || input == 12 ||
input == 6 || input == 3 )
numberCount ++;
i ++;
}

cout << endl;
cout << "The count was " << numberCount << endl;
}