Here is my code … I want to stop it on the result, but result is showing after pressing a key … It is flashing the result after pressing the key … I’m using Microsoft Visual C++6.0 and windows 7.
#include <iostream.h>
#include <conio.h>
#include <stdlib.h>
void main() {
int a, b, n;
int danni[6][25];
cout << "n= ";
cin >> n;
for (a = 0; a < n; a++) {
for (b = 0; b < n; b++) {
cout << "danni[" << a << "][" << b << "]= ";
cin >> danni[a][b];
}
}
for (a = 0; a < n; a++) {
cout << "\n ";
for (b = 0; b < n; b++) {
//cout<<danni[a][b]<<" ";
cout << "Fak nomer: " << a << b;
}
cout << "Spec: " << a << b;
cout << "Grupa: ";
cout << a << b;
cout << "Sreden uspeh: " << a << b;
}
system("pause");
}
Call
cout.flush();before system pause. Another option would be to add andcout << endl(as it hiddenly flushes the stream).