0
If u know c++ help quickly on this conundrum
Help me ( c++ ) Um trying to make an a.i program but it tells me I got an error on line 18:3 ... I followed it's instructions but I couldn't tell what it meant by it expected a primary expression before ')' #include <iostream> using namespace std; class sabrina { public: void sayHi() { cout << "Hi" << endl; } }; int main() { sabrina test; test.sayHi(); int a; cout<<" how are u \n how have u been \n ? "<< endl; cin>>a; ) if (a "um okay ; um fine ; um great") {cout<< "okay thats good to hear , u know its been long ever since we talked ryt "<<endl; else { cout<<" whats the matter? \n can you tell me pls"<< endl; } } }
15 odpowiedzi
+ 2
put ! in the if statement if (!strcmp (a,"um okay") &&! strcmp(a,"um fine ")) ya i know on solo learn it just print but try it on some other compiler it should run if u wanna run it on solo learn then use cin>>a; but this will scan only 1 word any word after the space will not be scan eg
hello world
only hello will get scanned n stored in "a"so when you display "a" cout <<a; you will only get hello
0
there is an ) on line 18 before the if statement remove it and ur if condition is wrong
0
Ok let me try
0
By taking it out , it led to more errors in which i fixed except for one it says it expects ')' before the if statement
0
did you change your if condition variable a is an int even your if closing braket is wrong
0
Wait , I should right it
If ( int a " words " ) {}
0
Wouldn't calling a an int again confuse the program as it is a data variable
0
add a library #include <string.h>
change int a; to char a [20]; and chnage cin >>a to fgets(a,20,stdin); and your if statement to if (strcmp (a,"um okay") && strcmp (a,"um fine "))
and check your if statement brackets {}
0
No , it just prints out instead of giving me an opportunity to answer
0
And run the else statement depending on my answer
0
Ok , 🤣🤣🤣 I'll just copy an a.i progam from the internet and past it
0
😂😂😂👍👍👍👍
0
Ash this is very simple program I can help.you fix it yourself in a simple way
but u need to know the basic concepts very well.
0
👀 note that I haven't finished my c++ course yet
0
Yes please help me