0
이유가 무엇인지 묻고 싶습니다. 런타임 오류 검사 # 2 프로그램을 수행 할 때? 저는 C 프로그래밍을 처음 접했습니다.런타임 검사 오류 # 2 수신
나는 Y/N 키를 입력 한 후 몇 가지 옵션이있는 콘솔 응용 프로그램을 만들려고합니다. 하지만 모든 옵션이 끝나면 오류가 발생합니다.
아무도 내가 그것을 해결할 수있는 방법을 말해 줄 수 없었다 & 프로그래밍의 이런 종류의 일을하는 적절한 방법은 무엇입니까? option
이 char
같이
#define _CRT_SECURE_NO_WARNINGS // To allow Visual studio to use "scanf" function
#include <stdio.h> // Standard Input output . header
#include <Windows.h>
void codername() {
printf("Coder: Rong Yuan\n");
}
void projectname() {
printf("Project name: NPoly Learning\n");
}
void loadcurrentdate() {
SYSTEMTIME str_t;
GetSystemTime(&str_t);
printf("Date: %d . %d . %d \n"
, str_t.wDay, str_t.wMonth, str_t.wYear);
}
int main() {
char option;
int input;
int mincome, fmember, total;
printf("Do you like to see our option? Y/N \n");
scanf("%s", &option);
if (option == 'y' || option == 'Y') {
printf("1. Display Coder Detail\n");
printf("2. Display Project Name\n");
printf("3. Load Current Date\n");
printf("4. Calculator PCI\n");
printf("5. Exit\n");
scanf("%d", &input);
}
else
exit(1);
switch (input) {
case 1:
codername();
printf("Do you like to return to main?");
break;
case 2:
projectname();
break;
case 3:
loadcurrentdate();
break;
case 4:
printf("Enter your house monthly income: ");
scanf("%d", &mincome);
printf("Enter total family member: (INCLUDING YOURSELF) ");
scanf("%d", &fmember);
total = mincome/fmember;
printf("Total PCI: %d/%d = %d \n", mincome, fmember, total);
system("pause");
break;
case 5:
exit(0);
}
}
오류 메시지를 게시물에 복사하십시오. ^^ – SlySherZ