//This program uses switch with char variable.
#include <iostream>
usingnamespace std;
#include <conio.h>
int main(){
int n1, n2;
bool control=true;
char opt;
while (control){
system("cls");
cout<<"Enter number1 and oporator and number2 :";
cin>>n1>>opt>>n2;
switch(opt){
case'+':
cout<<"\n"<<n1+n2;
break;
case'-':
cout<<"\n"<<n1-n2;
break;
case'*':
cout<<"\n"<<n1*n2;
break;
case'/':
cout<<"\n"<<n1/n2;
break;
default:
cout<<"\n operation is not legal";}
getch();
}
return 0;}
a blank window opens and nothing happens i cannot type anything inside it. i cannot cose it. after few minutes it closes automaticly.
I amusing:
windows 7.
kaspersky 9.
visual C++ 6.