Hey,
Here is my code:
Code:
#include <iostream>
using namespace std;
int main(void){
int x, i, total, perc;
char n[25], ar[20][20];
cin >> x;
cin.ignore();
for(i = 0; i < x; i++){
cin.getline(n, 25);
cin.ignore();
cin.getline(ar[i], 20);
cin.ignore();
perc = ((ar[0][0] * 100) / ar[0][1]);
cout << n << " " << perc << "%";
cin.ignore();
}
return 0;
}
'
Code:
Input:
1 (number of inputs)
Name (name of song)
48 52 (amount earned out of total)
Find the percentage
Well it doesn't work. I don't know whats going on with the arrays. ar[0][0] isn't 48 like i expected it to be.. same with ar[0][1]...
instead ar[0][0] somehow = 56 and ar[0][1] = 8... confused.
help please