찾으시는 취미가 있나요?

Why getChar doesn't work when I get an operator input when I make a calculator. Code: #include <cstdio> //Enter a mistake float getFloat(); //Enter Operator char getChar(); int main() { float value1; float value2; char oper; float result = 0; value1 = getFloat(); value2 = getFloat(); oper = getchar(); switch (oper) { (Broadcast) default: printf ("invalid operator)."); break; } } float getFloat() { float input; printf ("Please enter a mistake: "); scanf_s("%f", &input); return input; } char getChar() { char input; printf (please enter operator : "); scanf_s("%c", &input); return input; } When you build, you can receive up to two mistakes, but as soon as you receive the second one, the word incorrect operator is printed and it ends.
원본 보기
♡25
0

댓글0

클래스101은 모든 사람이 사랑하는 일을 하며
살 수 있도록 세상을 바꾸고자 합니다.
크리에이터
정규 클래스 지원하기
도움말
고객센터
오전 10시 ~ 오후 6시 (주말, 공휴일 제외)
주식회사 클래스101 | 대표 공대선 | 서울특별시 강남구 테헤란로 415, 4층(삼성동, 엘7강남타워) | ask@101.inc | 전화번호: 1800-2109 | 클라우드 호스팅: Amazon Web Services Korea LLC | 사업자등록번호 : 457-81-00277 | 통신판매업신고 : 2022-서울강남-02525 | 클래스101은 통신판매중개자로서 중개하는 거래에 대하여 책임을 부담하지 않습니다.