alias301reader
Programmer
- Jan 5, 2009
- 2
I am trying to do this:
#include <iostream>
#include <string>
#include <cstring>
int main (int argc, char *argv[])
{
// this is were the problem is I keep getting this:
// invalid conversion from ‘char’ to ‘const char*’
// initializing argument 1 of ‘int strcmp(const char*, const char*)’
if (strcmp(argv[1][1], "y") == 0){
std::cout << "Yes" << std::endl;
} else {
std::cout << "No" << std::endl;
}
return 0;
}
#include <iostream>
#include <string>
#include <cstring>
int main (int argc, char *argv[])
{
// this is were the problem is I keep getting this:
// invalid conversion from ‘char’ to ‘const char*’
// initializing argument 1 of ‘int strcmp(const char*, const char*)’
if (strcmp(argv[1][1], "y") == 0){
std::cout << "Yes" << std::endl;
} else {
std::cout << "No" << std::endl;
}
return 0;
}