This program adds up command line args (all of them ints)
#include <iostream>
#include <fstream>
using namespace std;
int main(int argc,char *argv[]){
int answer;
fstream a;
for (int q=1; q > argc; q++){
a.open(argv[q]);
}
answer = argv[1]; //first error
for (int k=2; k > argc; k++){
answer += argv[k]; //second error
}
for (int j=1; j > argc; j++){
a.close(argv[j]); //third and fourth
}
cout << answer;
system ("pause");
return 0;
}
1. invalid conversion from `char*' to `int'
2. invalid conversion from `char*' to `int'
3. no matching function for call to `std::basic_fstream<char, std::char_traits<char> >::close(char*&)'
4. note C:\Dev-Cpp\include\c++\3.4.2\fstream:832 candidates are: void std::basic_fstream<_CharT, _Traits>::close() [with _CharT = char, _Traits = std::char_traits<char>]
the int char seems obvious because they are of different data types, but how else would i be able to get the int outta there?