I am tryin to take some repetition out of an assignment and having difficulties. Keep getting C2664 errors and maybe yall can tell me wtf I am doing wrong =( Probably something simple but daimen having kinda same problem few posts below =/
// John
// CSCI 1106
// mycodemate prob more advanced
#include <iostream>
#include <cstring>
//#include <strcmp>
using namespace std;
int main () {
const int SIZE = 40;
int count;
char *runner[SIZE];
double *time[SIZE];
cout << runner[1] << " : " << time[1] << endl; // This just for test purpose
cout << runner[2] << " : " << time[2] << endl; // plan on adding strcmp then
cout << runner[3] << " : " << time[3] << endl; // listing them in order by time
return 0;
}
the errors I get are:
Error 1 error C2664: 'std::basic_istream<_Elem,_Traits> &std::basic_istream<_Elem,_Traits>::get(_Elem *,std::streamsize)' : cannot convert parameter 1 from 'double *' to 'char *'
We have not covered throwing array in loop yet so been experimenting to complete failure =/
also, how do you copy outta visual 08 and able to display line counts? lol
ok thanks! I changed it to char instead of double. now when I ran it loaded fine, Enter runners name: (entered a random name), now I have a "xxrunners.exe has encountered a problem and needs to close" so frustrating lol
any input I put in I get that error.. figured it might have been just XP so I wrote it on my laptop as well (vista) and I recieved the same thing. The only line I changed was:
double *time[SIZE]; to char * time[SIZE];
copy and see if you get same results =(
// John
// CSCI 1106
// mycodemate prob more advanced
#include <iostream>
#include <cstring>
//#include <strcmp>
using namespace std;
int main () {
const int SIZE = 40;
int count;
char *runner[SIZE];
char *time[SIZE];
cout << runner[1] << " : " << time[1] << endl; // This just for test purpose
cout << runner[2] << " : " << time[2] << endl; // plan on adding strcmp then
cout << runner[3] << " : " << time[3] << endl; // listing them in order by time
return 0;
}
I been stuck trying to figure this little problem out for a day now when I don't even need it for class but want to learn it lol
I will try to sneak into my professors other lab tomorrow and see if he can help me as well, if not my lab is wed night...