When I called function klubovi everithing is ok I put strings club1 and club2, but when I called switch (2) or (3) or just want to cout << club1 << club2; he write me just club2. WHY !!!Code:#include <cstdlib>
#include <ctime>
#include <iostream>
using namespace std;
void klubovi ( char club1 [100], char club2 [100])
{
cout << "\nUnesite ime domaceg tima: ";
cin.getline (club1,100);
cin.ignore (100,'\n');
cout << "Unesite ime gostujuceg tima: ";
cin.get(club2,100);
};
int main()
{
int novac = 100;
while(novac > 0)
{
novac = 100;
char club1 [100];
char club2 [100];
int broj;
cout << "\n\nODABERITE OBLAST: ";
cin >> broj;
switch (broj)
case 1:
{
klubovi (club1,club2);
cout << club1 << club2;
srand(time(0));
float kv1;
kv1 = 1.05 + (rand() % 3);
float kv2;
kv2 = 1.05 + (rand() % 3);
float kv3;
kv3 = 2.1 + (rand() % 3);
break;
case 2:
cout << club1 << " : " << club2;
break;
case 3:
cout << "\n##### KVOTE #####\n";
cout << "-----------------\n";
cout << club1 << ": " << kv1;
cout << "\n" << club2 << ": " << kv2;
cout << "\nnerijeseno: " << kv3;
case 6:
srand(time(0));
int rez1;
rez1 = 0 + (rand()%5);
int rez2;
rez2 = 0 + (rand() % 5);
break;
}
}
}
Same thing is if I put function klubovi to switch (1) or enywhere in while ();
WHY he not erite me club1 ???