希望我没有在尝试缩进所有行时搞砸代码。基本上,我有一个 C 程序,它接受用户输入,搜索数组,如果它与数组中的内容匹配,则打印一些内容。数组的后半部分只是我将值放在那里的编程方式。我认为把它们写出来是一种懒惰的方式(在某种意义上)。
Xcode 没有显示任何错误,几乎用户输入的每个数字都应该产生某种结果,但我什至无法得到它。当我运行它时,它会像预期一样要求两个输入,然后只返回 0。至少如果它打印了错误的答案,我能够弄清楚,但这可能是我还不明白的更深层次的东西。希望我做了一些愚蠢的事情,但我无法弄清楚。任何帮助都会很棒。
#include <stdio.h>
float sph;
float cyl;
float sixSevenFive[] = {6.5, 6.25, 6.0};
float six[] = {5.75, 5.5, 5.25};
float five[] = {5.0, 4.75, 4.5, 4.25};
float fourFive[] = {4.0, 3.75, 3.5};
float four[] = {3.25, 3.00, 2.75, 2.5, 2.25, 2.0, 1.75, 1.5, 1.25, 1.0, 0.75, 0.5, 0.25};
float three[8];
float two[7];
float one[6];
float zeroFive[7];
float zeroTwoFive[13];
// function to push values into arrays
void pushArray();
// function to find the base curve to use
void findBase();
// function to transpose sphere and cylinder
void transpose();
int main(int argc, const char * argv[])
{
void pushArray();
printf("Enter sphere power: ");
scanf("%f", &sph);
printf("Enter cylinder power: ");
scanf("%f", &cyl);
void transpose();
void findBase();
return 0;
}
最佳答案
你的函数调用在main
内是错误的;
void pushArray();
void transpose();
void findBase();
从函数调用中删除 void
。
pushArray();
transpose();
findBase();
关于c - 程序没有产生结果,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/21460253/