Я хотел бы спросить, почему я получаю проверку выполнения во время выполнения # 2 Когда я выполняю свою программу? Я очень новичок в программировании на С.Получение ошибки проверки времени выполнения # 2
Я пытаюсь создать консольное приложение, у которого есть опция после того, как они вводят Y/N, Но всякий раз, когда я достигаю конца всей опции, я получаю эту ошибку.
Может ли кто-нибудь сказать мне, как я мог его решить? & Каков правильный способ выполнения такого рода программирования?
#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);
}
}
Скопируйте сообщение об ошибке в сообщение post ^^ – SlySherZ