- 论坛徽章:
- 0
|
以上是三个文件,使用QT4.3.2来编译,想问下如何会出现运行的结果。先把程序传上来:
square.h文件
#ifndef SQUARE_H
#define SQUARE_H
double square(double );
#endif
square.cpp文件
double square(double n)
{
return n*n;
}
main.cpp文件
#include <cstdlib>
#include <iostream>
#include "square.h"
int main(int argc,char *argv[])
{
if (argc !=2){
std::cerr<<"Usage:square<number>"<<std::endl;
return 1;
}
double n=std::strtod(argv[1],0);
std::cout<<"The square of"<<argv[1]<<"is"
<<square(n)<<std::endl;
return 0;
}
先qmake -project编译
然后qmake
最后make
找到DEBUG文件夹下的二进制文件,然后运行,但是没有出现输入数字,然后得平方的交互界面啊?
这上什么回事啊,帮分析一下,我用的操作系统是WINDOWS,是在DOS窗口下运行这个生成的二进制程序! |
|