Skip to content
This repository was archived by the owner on May 27, 2019. It is now read-only.

Commit 0f641c1

Browse files
committed
Merge branch 'error-handling' into development
2 parents 966bf17 + e8010e5 commit 0f641c1

1 file changed

Lines changed: 10 additions & 10 deletions

File tree

Program.cpp

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ void Program::start() {
4343
break;
4444

4545
default:
46-
cout << "Nie ma takiej opcji, wybierz jeszcze raz." << endl;
46+
cerr << "Nie ma takiej opcji, wybierz jeszcze raz." << endl;
4747
breakMainMenu = true;
4848
break;
4949
}
@@ -64,7 +64,7 @@ void Program::start() {
6464
try {
6565
graph->loadDataFrom(file);
6666
} catch (const char* e) {
67-
cout<<e<<endl;
67+
cerr << e << endl;
6868
}
6969
break;
7070

@@ -73,13 +73,13 @@ void Program::start() {
7373
while (!(cin >> numberOfVerticles)) {
7474
cin.clear();
7575
cin.ignore(numeric_limits<streamsize>::max(), '\n');
76-
cout << "Bledna wartosc! Podaj ilosc wierzcholkow: ";
76+
cerr << "Bledna wartosc! Podaj ilosc wierzcholkow: ";
7777
}
7878
cout << "Podaj gestosc grafu: ";
7979
while (!(cin >> density)) {
8080
cin.clear();
8181
cin.ignore(numeric_limits<streamsize>::max(), '\n');
82-
cout << "Bledna wartosc! Podaj gestosc grafu: ";
82+
cerr << "Bledna wartosc! Podaj gestosc grafu: ";
8383
}
8484

8585
graph->generate(numberOfVerticles, density);
@@ -116,7 +116,7 @@ void Program::start() {
116116
break;
117117

118118
default:
119-
cout << "Nie ma takiej opcji, wybierz jeszcze raz." << endl;
119+
cerr << "Nie ma takiej opcji, wybierz jeszcze raz." << endl;
120120
break;
121121
}
122122

@@ -163,20 +163,20 @@ void Program::runAlgorithm(char index) {
163163
int arg1;
164164
int arg2;
165165
if (graph->getNumberOfAvailableAlgorithms() > index - 1) {
166-
cout<<"Podaj argument 1: ";
166+
cout << "Podaj argument 1: ";
167167
while (!(cin >> arg1)) {
168168
cin.clear();
169169
cin.ignore(numeric_limits<streamsize>::max(), '\n');
170-
cout << "Bledna wartosc! Podaj argument 1: ";
170+
cerr << "Bledna wartosc! Podaj argument 1: ";
171171
}
172-
cout<<"Podaj argument 2: ";
172+
cout << "Podaj argument 2: ";
173173
while (!(cin >> arg2)) {
174174
cin.clear();
175175
cin.ignore(numeric_limits<streamsize>::max(), '\n');
176-
cout << "Bledna wartosc! Podaj argument 2: ";
176+
cerr << "Bledna wartosc! Podaj argument 2: ";
177177
}
178178
graph->runAlgorithm(index, arg1, arg2);
179179
} else {
180-
cout << "Nie ma takiej opcji, wybierz jeszcze raz." << endl;
180+
cerr << "Nie ma takiej opcji, wybierz jeszcze raz." << endl;
181181
}
182182
}

0 commit comments

Comments
 (0)