- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
<小时/>
大家好, 当我尝试执行和编译我的代码时
#include <stdio.h>
#include <math.h>
#define PI 3.14159
void MainMenu();
double MenuToChoose(double R,double r,double volume,double area,int choice);
double FindTheVolumeAndSurfaceArea(double R,double r);
double Compute(double R,double r,double volume,double density,int choice1,double mass,double L1,double S1,double C1,double B1,double N1,double I1,double A1);
int main(){
int choice;
double R,r,volume,area;
do{
MainMenu();
MenuToChoose(R,r,area,volume,choice);
}
while (choice != 3);
}
void MainMenu(){
int choice;
double R,r;
double area,volume;
printf("\n-------------------------------------------");
printf("\n1- Volume and Surface area of the sphare");
printf("\n2- Mass of the sphare");
printf("\n3- Exit");
printf("\n\n Please Enter your Choice: ");
scanf("%d",&choice);
printf("\nYour choice is: %d",choice);
if(choice == 1){
printf("\nYour have chosen to find Volume and Surface area: ");
printf("\nEnter Radii of the sphere: ");
scanf("%lf %lf",&R,&r);
FindTheVolumeAndSurfaceArea(R,r);
}
if(choice == 2){
MenuToChoose(R,r,area,volume,choice);
}
if(choice == 3){
printf("Your choice (3) to Exit.");
printf("\nThanks for using my program !");
return ;
}
double MenuToChoose(double R,double r,double area,double volume,int choice){
char choice1,L,l,S,s,C,c,B,b,N,n,I,i,A,a;
double mass,L1,S1,C1,B1,N1,I1,A1,density;
printf("\nYour have chosen to find Mass of object: ");
printf("\nEnter Radii of the sphere: ");
scanf("%lf %lf",&R,&r);
printf("\nSolids Density (g/cm3)");
printf("\n--------------------------------");
printf("\nL Lead 11.37");
printf("\nS Silver 10.57");
printf("\nC Copper 8.92");
printf("\nB Brass 8.90");
printf("\nN Nickel 8.57");
printf("\nI Iron 7.90");
printf("\nA Aluminium 2.67");
density = L1 = 11.37;
density = S1 = 10.57;
density = C1 = 8.92;
density = B1 = 8.90;
density = N1 = 8.57;
density = I1 = 7.90;
density = A1 = 2.67;
printf("\n Enter choice: ");
scanf(" %c",&choice1);
Compute(R, r, volume, density,choice1, mass, L1, S1, C1, B1, N1, I1, A1);
return density;
return choice1;
return L1;
return S1;
return C1;
return B1;
return N1;
return I1;
return A1;
}
double FindTheVolumeAndSurfaceArea(double R,double r){
double area,volume;
area = 3 * PI * pow(r,2) + PI * (pow(R,2));
volume = ((4/3.0) * PI * (pow(r,3) - pow(R,3) ))/2;
printf("\n\nVolume = %.2lf Area = %.2lf",volume,area);
MainMenu();
}
double Compute(double R,double r,double volume,double density,int choice1,double mass,double L1,double S1,double C1,double B1,double N1,double I1,double A1){
printf("\nEnter Radii of the sphere: ");
scanf("%lf %lf",&R,&r);
/********************************************************/
if(choice1 == 'L' || choice1 == 'l'){
mass = volume * L1;
printf("\nSemi Sphare mass = %.2lf\n\n",mass);}
else if(choice1 == 'S' || choice1 == 's'){
mass = volume * S1;
printf("\nSemi Sphare mass = %.2lf\n\n",mass);}
else if(choice1 == 'C' || choice1 == 'c'){
mass = volume * C1;
printf("\nSemi Sphare mass = %.2lf\n\n",mass);}
else if(choice1 == 'B' || choice1 == 'b'){
mass = volume * B1;
printf("\nSemi Sphare mass = %.2lf\n\n",mass);}
if(choice1 == 'N' || choice1 == 'n'){
mass = volume * N1;
printf("\nSemi Sphare mass = %.2lf\n\n",mass);}
else if(choice1 == 'I' || choice1 == 'i'){
volume = ((4/3.0) * PI * (pow(r,3) - pow(R,3) ))/2;
mass = volume * I1;
printf("\nSemi Sphare mass = %.2lf\n\n",mass);}
else if(choice1 == 'A' || choice1 == 'a'){
mass = volume * A1;
printf("\nSemi Sphare mass = %.2lf\n\n",mass);}
/*******************************************************/
}
}
//void Check(R,r){
// int temp;
// if (R > r)
// {
// temp = R;
// R = r;
// r = temp;
// }
//}
//
我收到以下错误:
main.c: In function ‘MainMenu’:
main.c:26:2: warning: ignoring return value of ‘scanf’, declared with attribute warn_unused_result [-Wunused-result]
scanf("%d",&choice);
^
main.c:31:2: warning: ignoring return value of ‘scanf’, declared with attribute warn_unused_result [-Wunused-result]
scanf("%lf %lf",&R,&r);
^
/tmp/ccP8hsTP.o: In function `MainMenu':
main.c:(.text+0x105): undefined reference to `FindTheVolumeAndSurfaceArea'
main.c:(.text+0x132): undefined reference to `MenuToChoose'
/tmp/ccP8hsTP.o: In function `main':
main.c:(.text.startup+0x22): undefined reference to `MenuToChoose'
collect2: error: ld returned 1 exit status
这到底是怎么回事?!我多次尝试解决它,但我不能谢谢,IIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIII
最佳答案
MainMenu
末尾缺少右花括号 }
。这就是为什么您会收到“ undefined reference ”错误。文件末尾还有一个额外的 }
。基本上 MainMenu
之后的所有函数都嵌套在 MainMenu
中。
关于c - 对 `FindTheVolumeAndSurfaceArea' 的 undefined reference ,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/47364814/
我只是有一个更琐碎的问题。 为什么undefined == undefined 返回true,而undefined >= undefined 为false? undefined 等于 undefine
用PHP 7.2编写套接字服务器。根据Firefox 60中的“网络”选项卡,服务器的一些HTTP响应的第一行随机变为undefined undefined undefined。因此,我尝试记录套接字
在 JavaScript 中这是真的: undefined == undefined 但这是错误的: undefined <= undefined 起初我以为<=运算符包含第一个,但我猜它试图将其转换
在回答这个问题 (Difference between [Object, Object] and Array(2)) 时,我在 JavaScript 数组中遇到了一些我以前不知道的东西(具有讽刺意味的
来自https://developer.mozilla.org/en/docs/Web/JavaScript/Reference/Global_Objects/Array/of , Note: thi
我正在运行 PHP 脚本并继续收到如下错误: Notice: Undefined variable: my_variable_name in C:\wamp\www\mypath\index.php
我正在运行 PHP 脚本并继续收到如下错误: Notice: Undefined variable: my_variable_name in C:\wamp\www\mypath\index.php
当我添加 到我的 PrimeFaces Mobile 页面,然后我在服务器日志中收到以下警告 WARNING: JSF1064: Unable to find or serve resource, u
我正在运行 PHP 脚本并继续收到如下错误: Notice: Undefined variable: my_variable_name in C:\wamp\www\mypath\index.php
我正在运行 PHP 脚本并继续收到如下错误: Notice: Undefined variable: my_variable_name in C:\wamp\www\mypath\index.php
我正在运行 PHP 脚本并继续收到如下错误: Notice: Undefined variable: my_variable_name in C:\wamp\www\mypath\index.php
我正在运行 PHP 脚本并继续收到如下错误: Notice: Undefined variable: my_variable_name in C:\wamp\www\mypath\index.php
我正在运行 PHP 脚本并继续收到如下错误: Notice: Undefined variable: my_variable_name in C:\wamp\www\mypath\index.php
我正在运行 PHP 脚本并继续收到如下错误: Notice: Undefined variable: my_variable_name in C:\wamp\www\mypath\index.php
我正在运行 PHP 脚本并继续收到如下错误: Notice: Undefined variable: my_variable_name in C:\wamp\www\mypath\index.php
我正在运行 PHP 脚本并继续收到如下错误: Notice: Undefined variable: my_variable_name in C:\wamp\www\mypath\index.php
我正在运行 PHP 脚本并继续收到如下错误: Notice: Undefined variable: my_variable_name in C:\wamp\www\mypath\index.php
我正在运行 PHP 脚本并继续收到如下错误: Notice: Undefined variable: my_variable_name in C:\wamp\www\mypath\index.php
我正在运行 PHP 脚本并继续收到如下错误: Notice: Undefined variable: my_variable_name in C:\wamp\www\mypath\index.php
我正在运行 PHP 脚本并继续收到如下错误: Notice: Undefined variable: my_variable_name in C:\wamp\www\mypath\index.php
我是一名优秀的程序员,十分优秀!