goto skip_loop;

closed account (2E0XoG1T)
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
#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"){
		cout << "Volim te cunkice!!\n";
		goto skip_loop;
	}
	else if (dolazak == "ne")
		cout << "Mrzim te cunkice\n";
	do{
		cout << "A sad?";
		cin >> dolazak;
	}
	while (dolazak != "da");
	if(dolazak == "da"){
		cout << "Volim te cunkice!!\n";
	}
	skip_loop;
	char x;
	cin >> x;
	return 0;
}

Why skip_loop isnt working?
You've written a ; instead of : after skip_loop :)
closed account (2E0XoG1T)
Thanks dude.
Don't use goto, it's generally bad form. Break is sometimes acceptable but goto should be avoided unless absolutely necessary. For example in this case you should just use break and some conditions to get past the other loops. getting accustomed to using goto will get you into some confounding prog situations.
Much better form:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
	if (dolazak == "da"){
		cout << "Volim te cunkice!!\n";
		//goto skip_loop;   // <-   bad
	}
	else
	{
		if (dolazak == "ne")
			cout << "Mrzim te cunkice\n";
		do{
			cout << "A sad?";
			cin >> dolazak;
		}
		while (dolazak != "da");
		if(dolazak == "da"){
			cout << "Volim te cunkice!!\n";
		}
	}

Topic archived. No new replies allowed.