ช่วยแก้ code จาก dev c เป็น c++ หน่อยค่ะ ช่วยหน่อยนะค่ะ

#include <stdio.h>
#include <conio.h>

void main(){
    int ch;
    int firstnumber;
    int secondnumber;
    int result;

    do{
    clrscr();//Clear Scrren
    //Display Menu
    printf("\t Lists of an arithmetic operator\n");
    printf("\t 1)Addition (+)\n");
    printf("\t 2)Subtraction (-)\n");
    printf("\t 3)Multiplication (*)\n");
    printf("\t 4)Divistion (/)\n");
    printf("\t 5)Exit\n");

    //select menu
    ch = getch();

    //input 2 numbers for calculate
    //ch '1'=49, '2'=50, '3'=51, '4'=52, '5'=53
    if(ch==49 || ch == 50 || ch==51 || ch==52){
        printf("\n\t Input a first number: ");
        scanf("%d",&firstnumber);

        printf("\t Input a second number: ");
        scanf("%d", &secondnumber);
    }

    switch(ch){
        case 49: result = firstnumber + secondnumber;
        break;
        case 50: result = firstnumber - secondnumber;
        break;
        case 51: result = firstnumber * secondnumber;
        break;
        case 52: result = firstnumber / secondnumber;
        break;
        default :
          if(ch != 53){
            printf("\t Please select menu 1 to 5\n");
          }

    }

    //Display result
    if(ch==49 || ch ==50 || ch==51 || ch==52){
        printf("\t Result = %d\n", result);
    }

    //waiting for Enter key
    getch();

    }while(ch!= 53);



}
แสดงความคิดเห็น
อ่านกระทู้อื่นที่พูดคุยเกี่ยวกับ  วิศวกรรมคอมพิวเตอร์
โปรดศึกษาและยอมรับนโยบายข้อมูลส่วนบุคคลก่อนเริ่มใช้งาน อ่านเพิ่มเติมได้ที่นี่