how do i equate strings in if statements
Code:int main(0{
string str;
if(str = "hello"){...}
return 0;
}
Printable View
how do i equate strings in if statements
Code:int main(0{
string str;
if(str = "hello"){...}
return 0;
}
Use == to test for equality with strings just like built in types.
How can I modify the code to input the second columns of the following data file into array x[N]
VELOCITY
3 4 5
4 5 6
...N
x[] = 4, 5 ...N
ThanksCode:int main(){
double x[N];
ifstream in("file.txt");
int i = 0;
while (i < N && in >> x[i])
{
i++;
}
}
That's a totally different question, so start a new thread.
Also, it looks like homework.