I have this code, it finds x ^ y. I want to pass two floating point vars at the command line, so I used char** argv and then tried to convert the argv[1] and argv[2] to a float, but I get the error "pointer value used where a floating point value was expected." how do i convert properly.
#include <iostream>
#include <math.h>
#include <stdlib.h>
int main(int argc, char** argv) {
float x, y;
if(argc != 3) {
cout << "Usage: pow x y\n";
}
else {
x = float(argv[1]);
y = float(argv[2]);
cout << pow(x, y) << "\n";
}
system("PAUSE"
;
return 0;
} shaun
#include <iostream>
#include <math.h>
#include <stdlib.h>
int main(int argc, char** argv) {
float x, y;
if(argc != 3) {
cout << "Usage: pow x y\n";
}
else {
x = float(argv[1]);
y = float(argv[2]);
cout << pow(x, y) << "\n";
}
system("PAUSE"
return 0;
} shaun