Hey guys,
First of all, love the boards. They have definetly helped me through some tough times this semester. That being said, I need some help here.
I am taking an Intro to Computer Science Class at a local community college. Its about a 35 minute drive every Tuesday and Thursday morning. I havent been able to go as of late because I have a full-time job as Video Producer and Graphic Designer. I work for a small publishing company and have some big very important release dates coming up.
My brothers wedding is also this Saturday and my fiance and I are still planning our wedding which is coming up very soon!
The only reason i'm taking this class is because at college, this is a prerequisite for HTML course. Doesn't make any sense to me either but its the hand I'm dealt with.
I am not a computer Science Porogramming and never will be.
I need help with this assignment. The assignment is due Thursday.
The assignemt is:
Write a Program that reads the integers between 1 and 100 and counts the occurrence of each number. Assume the input ends with 0.
**Note** if a number occurs more than one time, the plural word "times" is used in the output.
ITS IN C++ FORMAT, WRITTEN IN THE DEV C++ Program!
Heres the coding I have so far:
Code:
#include <iostream>
#include <cstdlib>
#include <string>
using namespace std;
int inVal = 0;// for the entry of each value
int valTally[100] = {0};// a place to store the counts for each number which could be entered.
{
string num = "";
char search = '0';
int i = 0;
int count = 0;
do
{
cout << "Enter a value of 1-100 (0 to quit): "; cin >> inVal;
// check that inVal is in range so the array bounds aren't exceeded
// tally the value
}while(inVal != 0);
for (i = 0; i < num.length(); i++)
{
//cout << num[i] << endl;
if ( num[i] == search )
{
count++;
}
}
cout << endl << "Number of occurences: " << count << endl;
system("PAUSE");
return 0;
}