c - 程序没有产生结果

标签 c

希望我没有在尝试缩进所有行时搞砸代码。基本上,我有一个 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/

相关文章:

c - C 中的随机排列数组

创建包含 ncurses 的静态库

c - while 循环的错误输出

c - 如何将从文件收集的字符串复制到新数组中以在 C 中进行控制台输出

c - 时差为零秒

shell - 使用 SIGTSTP 挂起子进程后,shell 没有响应

c - 允许创建多少个 netlink 协议(protocol)?

c++ - 获取二进制文件的数据和代码区域的大小

c - 八进制/十六进制符号从何而来?

c++ - Pi 计算器程序每次运行时都会给出不同的输出