im going to take this summer course for advanced science/math/a little programming over the summer (its at OSU, i believe its called SI2003, its for current high school freshmen and sophmores) and you have to answer some sample questions to see wut you know
one of the questions is you have to make a 5 by 7 array that will hold 35 single diget ints the person types in. then it tells how many 0s there are, 1s there are etc.
i can do all of that, but then you have to make it tell where they are (ie [3][5] or whatever) i tried several methads but none of them worked. i dont want someone to tell me the answer cuz im supposed to do it myself, but if you could point me in the right direction, it would be appreciated.
here is my latest attempt:
Code:
#include <iostream>
#include <string>
using namespace std;
int zero, one, two, three, four, five, six, seven, eight, nine;
int osu[7][5];
int zeroa[5][7];
int zerob[5][7];
int onea[5][7];
int oneb[5][7];
int twoa[5][7];
int twob[5][7];
int threea[5][7];
int threeb[5][7];
int foura[5][7];
int fourb[5][7];
int fivea[5][7];
int fiveb[5][7];
int sixa[5][7];
int sixb[5][7];
int sevena[5][7];
int sevenb[5][7];
int eighta[5][7];
int eightb[5][7];
int ninea[5][7];
int nineb[5][7];
int a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s, t, u, v, x;
void input()
{
cout <<"Please enter 35 single diget integers.\n";
for(a = 0;a < 7;a++)
{
for(b = 0;b < 5;b++)
{
cin >>x;
if(x<0 || x>9);
{
cout <<"The number you have entered is in valid. Please try again.\n";
}
else
{
osu[a][b] = x;
}
}
}
}
void count()
{
for(a = 0;a < 7;a++)
{
for(b = 0;b < 5;b++)
{
if(osu[a][b] == 0)
{
zero++;
zeroa[c] = c;
zerob[d] = d;
c++;
d++;
}
else{
if(osu[a][b] == 1)
{
one++;
onea[e] = e;
oneb[f] = f;
e++;
f++;
}
}
else{
if(osu[a][b] == 2)
{
two++;
twoa[g] = g;
twob[h] = h;
g++;
h++;
}
}
else{
if(osu[a][b] == 3)
{
three++;
threea[i] = i;
threeb[j] = j;
i++;
j++;
}
}
else{
if(osu[a][b] == 4)
{
four++;
foura[k] = k;
fourb[l] = l;
k++;
l++;
}
}
else{
if(osu[a][b] == 5)
{
five++;
fivea[m] = m;
fiveb[n] = n;
m++;
n++;
}
}
else{
if(osu[a][b] == 6)
{
six++;
sixa[o] = o;
sixb[p] = p;
o++;
p++;
}
}
else{
if(osu[a][b] == 7)
{
seven++;
sevena[q] = q;
sevenb[r] = r;
q++;
r++;
}
}
else{
if(osu[a][b] == 8)
{
eight++;
eighta[s] = s;
eightb[t] = t;
s++;
t++;
}
}
else{
if(osu[a][b] == 9)
{
nine++;
ninea[u] = u;
nineb[v] = v;
u++;
v++;
}
}
}
}
}
void output()
{
cout <<"There were a total of " <<zero <<" zeros.\n"
/*here i would put something like
cout <<"They were at location:" <<zero[a][b];
or something like that, but im not sure */
cout <<"There were a total of " <<one <<" ones.\n"
cout <<"There were a total of " <<two <<" twos.\n"
cout <<"There were a total of " <<three <<" threes.\n"
cout <<"There were a total of " <<four <<" fours.\n"
cout <<"There were a total of " <<five <<" fives.\n"
cout <<"There were a total of " <<six <<" sixs.\n"
cout <<"There were a total of " <<seven <<" sevens.\n"
cout <<"There were a total of " <<eight <<" eights.\n"
cout <<"There were a total of " <<nine <<" nines.\n"
}
int main()
{
input();
output();
system("Pause");
return 0;
}
in addtion to the 50 billion different errors i get, i dont think it would work