Ich weis jetzt nicht was fürn Programm du nun nutzt,
aber folgendes musst du machen wenn du MS:VS nutzt:
Code:
-- Bibliothek einbindne
#include <conio.h>
-- Am Ende deiner Funktion:
getch();
Bei Dev C++ sieht das noch bissle anders aus.
Hier mal 'n zum Einstieg 'n Beispiel mit Counter und Modulo Operation:
Code:
/*
BLAAAAAAAR TEST!
*/
#include <iostream.h>
#include <conio.h>
void ModuloOperation()
{
int zahl1, zahl2;
cout << "Number 1: ";
cin >> zahl1;
cout << "\nNumber 2: ";
cin >> zahl2;
cout << "Modulo: " << zahl1%zahl2 << endl;
}
void Counter()
{
int from=0, to=0;
cout << "From: ";
cin >> from;
cout << "\nTo: ";
cin >> to;
for( int i=from; i<=to; i=i+1 )
{
cout << i << "..." << endl;
}
}
void main()
{
int option;
cout << "Hello there! Waht do you want to do?" << endl;
cout << "\n1. Modulo operation\n2. Counter\n" << endl;
cin >> option;
switch( option )
{
case 1:
ModuloOperation();
break;
case 2:
Counter();
break;
default:
cout << "Error!" << endl;
}
getch();
}