Professional Documents
Culture Documents
C++ CODE:
#include <iostream>
int main(){
char Y, oper ;
cin>>num1;
cin>>num2;
cin>>num3;
cin>>num4;
cout<<endl;
Y:
cout<<"USER OPERATOR"<<endl<<endl;
cout<<"Press: "<<endl;
2
cout<<" (*) For MULTIPLICATION"<<endl;
cin>>oper;
switch(oper){
case '+':{
break;}
case '-':{
break; }
case '/':{
break; }
case '*':{
break; }
default:{
goto Y;
break; }
return 0;
3
2. Write a C++ code that simulate a Driving of a manual car
a. Should indicate starting of a car
h. After speed has reached 60 apply break and stop the car
C++ CODE:
#include<iostream>
#include<windows.h>
void start(){
char S, A;
cin>>S;
Sleep(3000);
cin>>A;
Sleep(3000);
4
void speed(){
char B, C, D ;
for(int a=0;a<=60;a++){
cout<<"speed "<<a<<"km/hr"<<endl;
Sleep(1000);
if(a==20){
cin>>C;
else if(a==40){
cin>>D;
else if (a==60){
cin>>B;
cout<<"BREAK is applied"<<endl<<endl;
Sleep(3000);
int main(){
start();
speed(); return 0; }