C 程序不工作:程序<path>不存在 VS 代码



长话短说,我正在用c,visual studio代码制作计算器,但当我调试它时,它显示给我这个:输入图片描述

我从来没有遇到过这个错误;-;

下面是我的代码,如果有帮助的话:D
#include <stdio.h>
#include <stdlib.h>
void addition();
double division();
double subtraction();
void multiplication();

int main(){

int opt_i;
char opt_c;
double opt_d;
printf("nnWould you like to:");
printf("n1. Mutliply");
printf("n2.Divide");
printf("n3.Add");
printf("n4.Subtract");
printf("n(Choose a number)");
scanf("%d",opt_i);
if(opt_i==1){
multiplication();
}
else if(opt_i==2){
division();
}
else if(opt_i==3){
addition();
}
else if(opt_i==4){
subtraction();
}
else{
printf("Invalid Option :(");
sleep(3);
printf("Wanna restart? [y,n]");
printf("Your option: ");
scanf("%c",opt_c);
if(opt_c=='y'||opt_c=='Y'){
int main();
}
else if(opt_c=='n'||opt_c=='N'){
printf("Bye <:(");
sleep(2);
exit(0);
}
else{
printf("Invalid Option again dude check your keyboard or smth :| :O 0_0 o_o -_-");
}

}
void multiplication();{
int ntp;
int num1;
int num2;
int num3;
int num4;
int num5;
int ans;

printf("How many number would you like to multiply?(2-5) ");
scanf("%d",ntp);
if(ntp==2){
printf("Enter a number to multiply: ");
scanf("%d",&num1);
printf("Enter the second number to multiply: ");
scanf("%d",&num2);
ans = num1*num2;
printf("The answer is: %dn",ans);
}
else if(ntp==3){
printf("Enter a number to multiply: ");
scanf("%d",&num1);
printf("Enter the second number to multiply: ");
scanf("%d",&num2);
printf("Enter a third number to multiply: ");
scanf("%d",&num3);
ans = num1*num2*num3;
printf("The answer is: %dn",ans);
}
else if(ntp==4){
printf("Enter a number to multiply: ");
scanf("%d",&num1);
printf("Enter the second number to multiply: ");
scanf("%d",&num2);
printf("Enter a third number to multiply: ");
scanf("%d",&num3);
printf("Enter a fourth number to multiply: ");
scanf("%d",&num4);
ans = num1*num2*num3*num4;
printf("The answer is: %dn",ans);
}
else if(ntp==5){
printf("Enter a number to multiply: ");
scanf("%d",&num1);
printf("Enter the second number to multiply: ");
scanf("%d",&num2);
printf("Enter a third number to multiply: ");
scanf("%d",&num3);
printf("Enter a fourth number to multiply: ");
scanf("%d",&num4);
printf("Enter a fifth and final number to multiply: ");
ans = num1*num2*num3*num4*num5;
printf("The answer is: %dn",ans);
}
}


void addition();{
int ntp;
int num1;
int num2;
int num3;
int num4;
int num5;
int ans;
printf("How many number would you like to add?(2-5) ");
scanf("%d",ntp);
if(ntp==2){
printf("Enter a number to add: ");
scanf("%d",&num1);
printf("Enter the second number to add: ");
scanf("%d",&num2);
ans = num1+num2;
printf("The answer is: %dn",ans);
}
else if(ntp==3){
printf("Enter a number to add: ");
scanf("%d",&num1);
printf("Enter the second number to add: ");
scanf("%d",&num2);
printf("Enter a third number to add: ");
scanf("%d",&num3);
ans = num1+num2+num3;
printf("The answer is: %dn",ans);
}
else if(ntp==4){
printf("Enter a number to add: ");
scanf("%d",&num1);
printf("Enter the second number to add: ");
scanf("%d",&num2);
printf("Enter a third number to add: ");
scanf("%d",&num3);
printf("Enter a fourth number to add: ");
scanf("%d",&num4);
ans = num1+num2+num3+num4;
printf("The answer is: %dn",ans);
}
else if(ntp==5){
printf("Enter a number to add: ");
scanf("%d",&num1);
printf("Enter the second number to add: ");
scanf("%d",&num2);
printf("Enter a third number to add: ");
scanf("%d",&num3);
printf("Enter a fourth number to add: ");
scanf("%d",&num4);
printf("Enter a fifth and final number to add: ");
ans = num1+num2+num3+num4+num5;
printf("The answer is: %dn",ans);
}
}
}

这也是我的发射。因为当我收到错误时,它提示我打开启动。Json文件,这里是

{
"version": "0.2.0",
"configurations": [
{
"name": "C/C++ Runner: Debug Session",
"type": "cppdbg",
"request": "launch",
"args": [],
"stopAtEntry": false,
"externalConsole": false,
"cwd": "c:/Users/ghazi/Desktop/calculator",
"program": "c:/Users/ghazi/Desktop/calculator/build/Debug/outDebug",
"MIMode": "gdb",
"miDebuggerPath": "gdb",
"setupCommands": [
{
"description": "Enable pretty-printing for gdb",
"text": "-enable-pretty-printing",
"ignoreFailures": true
}
]
}
]
}

请回答这个问题😢

如消息所述,您无法执行cal.exe,因为它不存在。

它不存在,因为当您尝试构建它时发生了一些错误。其中一些可以在你的截图中看到。

一些错误源于函数定义中多余的分号。例如,下面的分号不应该出现在那里:

void multiplication();{
...
}

相关内容

  • 没有找到相关文章

最新更新