Hello, OnlineGDB Q&A section lets you put your programming query to fellow community users. Asking a solution for whole assignment is strictly not allowed. You may ask for help where you are stuck. Try to add as much information as possible so that fellow users can know about your problem statement easily.

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

+2 votes
asked Mar 21, 2020 by 童翰昇 (140 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, 2020 by Alan Sampson (440 points)
You coded getche() instead of getch() in the second do loop.
0 votes
answered Mar 25, 2020 by Alan Sampson (440 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.
...