Hello again, I fkced up once more. So, I have one while loop that will last forever (basicly last forever until user want to leave application) . And for example, if user enter 1, goto will put him back to while loop and trigger all this again. BUT, problem is that when that happen, somehow the code when user need to enter value is just passed and I don't want that to happen. Here is code:
#include <cstdlib>
#include <iostream>
using namespace std;
void Razvrstaj(int& a,int& b,string recenica);
int main(int argc, char *argv[])
{
Start:
while(1) {
string Recenica;
int Suglasnik = 0,Samoglasnik = 0;
cout << "Unesite Neku recenicu:" << endl;
getline(cin,Recenica);
Razvrstaj(Samoglasnik,Suglasnik,Recenica);
cout << "Ukupan broj samoglasnika je : " << Samoglasnik << endl << "Ukupan broj suglasnika je: " << Suglasnik << endl;
cout << endl << "Da li zelite uneti novu rec? (1-da/0-ne)" << endl;
int vrednost;
cin >> vrednost;
if (vrednost == 0) goto Kraj;
if (vrednost == 1) goto Start;
}
Kraj:
return EXIT_SUCCESS;
}
void Razvrstaj(int& a, int& b,string recenica) {
int duzina = recenica.length();
int razmak = 0;
for (int i = 0; i < duzina ; i++) if (isspace(recenica[i])) razmak++;
for (int i = 0; i < duzina ; i++) {
if( (recenica[i] == 'a') || (recenica[i] =='A') || (recenica[i] == 'E') || (recenica[i] == 'e') || (recenica[i] == 'I') ||
(recenica[i] == 'i') || (recenica[i] == 'O') || (recenica[i] == 'o') || (recenica[i] == 'U') || (recenica[i] == 'u')) {
a++;
}
else {
b++;
}
}
b -= razmak;
}