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.
Login
Login
OnlineGDB Q&A
Questions
Unanswered
Tags
Ask a Question
Ask a Question
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;
}
getch
getche
onlinegdb
Please
log in
or register to answer this question.
2 Answers
0
votes
answered
Mar 25, 2020
by
Alan Sampson
(
440
points)
You coded getche() instead of getch() in the second do loop.
Please
log in
or register to add a comment.
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.
Please
log in
or register to add a comment.
Welcome to OnlineGDB Q&A, where you can ask questions related to programming and OnlineGDB IDE and receive answers from other members of the community.
...