I need help with writng this code. can you fix whats wrong with this code. I wil
ID: 3903911 • Letter: I
Question
I need help with writng this code. can you fix whats wrong with this code. I will be adding more to it later.
#include <iostream>
#include <cmath>
#include <string>
using namespace std;
int main() {
if ( yes==filing_with two people) {
cout <<" Then have the second person enter there information below"<<endl;
}
cout << "Please enter no "<< endl;
cin >>no;
if ( no){
cout <<"You can skips this step and leve it blank" <<endl;
}
else {
cout <<"You are not fling with two peopl<< endl;
}
}
Explanation / Answer
I can figure out some little mistackes:
For string comparison
Yes is a string and filing_with two people is variable string
so there is a little mistake in if comparison statement
you need to write the comparison statement like this :
so here this will compare yes with variable string... if they are same it will produce 0 and it will works but if they are not same it will produce some non zero value.
other way to compare string :
if ( "yes"==filing_with two people )
this can also work but above expalained method is better.
Hope this helps!
You can ask your doubts in comment section.
Kindly appreciate the help by upvoting the answer. Thank you!