simple program
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32
|
#include <iostream>
#include <string>
#include <windows.h>
using namespace std;
int main()
{
SetConsoleDisplayMode(GetStdHandle(STD_OUTPUT_HANDLE),CONSOLE_FULLSCREEN_MODE,0);
string dolazak;
cout << "Pozz cukice, oces doci kuci??";
cin >> dolazak;
if (dolazak == "da"||"ok"||"oki"||"okej"||"aha"||"hocu"||"naravno"){
cout << "Volim te cunkice!!\n";
goto skip_loop;
}
else if (dolazak == "ne")
cout << "Mrzim te cunkice\n";
else if (dolazak == "mozda")
cout << "De se odluci!";
else cout << "Sori, program te nerazmije :(";
do{
cout << "A sad?";
cin >> dolazak;
}
while (dolazak != "da"||"ok"||"oki"||"okej"||"aha"||"hocu"||"naravno");
if(dolazak == "da"||"ok"||"oki"||"okej"||"aha"||"hocu"||"naravno"){
cout << "Volim te cunkice!!\n";
}
skip_loop:
char x;
cin >> x;
return 0;
}
|
Why is this not working? It does compile and start, but not working as it should.
What is not working?
e.g.
If I type "mozda" in console, It will cout << "Volim te cunkice!!" instead of cout << "De se odluci!"
Change:
if (dolazak == "da"||"ok"||"oki"||"okej"||"aha"||"hocu"||"naravno")
with:
if (dolazak == "da" || dolazak == "ok" || dolazak == "oki" || dolazak == "okej" || dolazak == "aha" || dolazak == "hocu" || dolazak == "naravno")
And in the while loop you have to do what I did aswell btw :)
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32
|
#include <iostream>
#include <string>
#include <windows.h>
using namespace std;
int main()
{
SetConsoleDisplayMode(GetStdHandle(STD_OUTPUT_HANDLE),CONSOLE_FULLSCREEN_MODE,0);
string dolazak;
cout << "Pozz cukice, oces doci kuci??";
cin >> dolazak;
if (dolazak == "da" || dolazak == "ok" || dolazak == "oki" || dolazak == "okej" || dolazak == "aha" || dolazak == "hocu" || dolazak == "naravno"){
cout << "Volim te cunkice!!\n";
goto skip_loop;
}
else if (dolazak == "ne")
cout << "Mrzim te cunkice\n";
else if (dolazak == "mozda")
cout << "De se odluci!";
else cout << "Sori, program te nerazmije :(";
do{
cout << "A sad?";
cin >> dolazak;
}
while (dolazak != "da" || dolazak != "ok" || dolazak != "oki" || dolazak != "okej" || dolazak != "aha" || dolazak != "hocu" || dolazak != "naravno");
if (dolazak == "da" || dolazak == "ok" || dolazak == "oki" || dolazak == "okej" || dolazak == "aha" || dolazak == "hocu" || dolazak == "naravno"){
cout << "Volim te cunkice!!\n";
}
skip_loop:
char x;
cin >> x;
return 0;
}
|
There is new shit now, when I type "da" when program cout << "a sad?"; it ask me "a sad?" again. instead of "Volim te cunkice"
I don't see the problem tbh but you could do it like this:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36
|
#include <iostream>
#include <string>
#include <windows.h>
using namespace std;
int main()
{
SetConsoleDisplayMode(GetStdHandle(STD_OUTPUT_HANDLE),CONSOLE_FULLSCREEN_MODE,0);
string dolazak;
cout << "Pozz cukice, oces doci kuci??";
cin >> dolazak;
if (dolazak == "da" || dolazak == "ok" || dolazak == "oki" || dolazak == "okej" || dolazak == "aha" || dolazak == "hocu" || dolazak == "naravno"){
cout << "Volim te cunkice!!\n";
goto skip_loop;
}
else if (dolazak == "ne")
cout << "Mrzim te cunkice\n";
else if (dolazak == "mozda")
cout << "De se odluci!";
else cout << "Sori, program te nerazmije :(";
do{
cout << "A sad?";
cin >> dolazak;
if (dolazak == "da" || dolazak == "ok" || dolazak == "oki" || dolazak == "okej" || dolazak == "aha" || dolazak == "hocu" || dolazak == "naravno")
{
break;
}
}
while (true);
cout << "Volim te cunkice!!\n";
skip_loop:
char x;
cin >> x;
return 0;
}
|
Thanks dude
*solved*
Topic archived. No new replies allowed.