Monday, January 2, 2012

Output in c++

Since you may want to test your sorting code you need some sort of output. Usually using a terminal and plain text. In c++ this is very simple: import iostrem.h with
#include <iostream.h>

You can now print something to the console via
cout << output;
 
This works also for input:
cin >> input;
 
If you want to print a complete array to the console use a for loop:
The endl command starts a new line. 
for (int i = 0; i < size; i++) {
    cout << a[i] << endl;
}





No comments:

Post a Comment