Why can not pass the compile for the program below, using OnlineGDB. It can pass on Dev-c++.

+1 vote
asked Mar 21 by (130 points)
#include <conio.h>     //getch()、getche()需要
#include <stdlib.h>     // system()需要
#include <stdio.h>     //putchar()需要

int main()
{
  char ch;
  int ch_ascii;
  do{
      ch=getch();  
      putchar(ch);
  }while(ch!='A');           // 輸入字元"A"結束重複結構
  printf("\n");                //換列
  do{
      ch=getche();  
      putchar(ch);
  }while(ch!='A');         // 輸入字元"A"結束重複結構
  printf("\n\n");           //換列
  system("pause");
  return 0;
}

2 Answers

0 votes
answered Mar 25 by (380 points)
You coded getche() instead of getch() in the second do loop.
0 votes
answered Mar 25 by (380 points)
Another consideration: OnlineGDB runs on Linux. What are the chances a call to system("pause") will work on Linux? There is no pause command in Linux, the program probably won't work even if you do get it to compile.
Welcome to OnlineGDB Q&A, where you can ask questions related to programming and OnlineGDB IDE and and receive answers from other members of the community.
...