C++ / Dört İslem

H

HZ.CİN

Cin Terbiyecisi
Ultra Member
Joined
Dec 22, 2019
Messages
387
Reaction score
73
Location
Cehennem
C++ / Dört İslem
Dört İslem


C++:
#include <iostream>
 
using std::cin;
 
using std::cout;
 
using std::endl;
 
 
 
int main() {
 
                  //variable declaretions
 
                  int num1,num2;
 
                  char operation;
 
 
 
                  //read two integer
 
                  cout<< “Enter two integer : ”;
 
                  cin>>num1>>num2;
 
                  
 
//read operation code
 
cout<< “Enter a select code:” <<endl;
 
            cout<< “         a for addition” <<endl;
 
            cout<< “         m for multiplication” <<endl;
 
            cout<< “         d for division   : ”;
 
            cin>>operation;
 
 
 
            switch (operation){
 
            case ‘a’:
 
            case ‘A’ :
 
                        cout<< “The sum of the numbers is ”<<num1+num2<<endl;
 
case ‘m’:
 
            case ‘M’ :
 
                        cout<< “The product of the numbers is ”<<num1*num2<<endl;
 
case ‘d’:
 
            case ‘D’ :
 
                        cout<< “The division of the numbers is ”<<num1/num2<<endl;
 
            default :
 
                        cout<< “Operation code is not acceptable”<<endl;
 
}         
 
            
 
            return 0;
 
1

1Enjoy

Forward
Owner
Joined
Jul 29, 2019
Messages
1,023
Reaction score
5,449
Bad
Kaynak türkçeleştirilmeli !
4 işlem yazmışsın çıkartma yok

Özen gösterelim konulara
 
SPAM IS FORBIDDEN!
  • SPAMMERS ARE BANNED FROM THE FORUM AND CANNOT USE ANY OF THE CHEATS
  • For example: thanks, thx, very good, asdqwe, working, ty and so on!
  • For example: Writing the same message over and over. thanks, thx and so on!
  • Copying and copying someone else's message is prohibited.
  • It is forbidden to send messages to increase the number of comments on threads that you have no knowledge of.
  • Write your own opinion when commenting!
  • If you see spam message, please let us know with the REPORT button!

Tema düzenleyici

Top Bottom