首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 开发语言 > C++ >

关于在c++6.0下使用dos命令行参数的C程序编译有关问题!

2012-02-12 
关于在c++6.0下使用dos命令行参数的C程序编译问题!!!程序如下,在vc++编译后就不知道咋办?如图,请会的朋友

关于在c++6.0下使用dos命令行参数的C程序编译问题!!!
程序如下,在vc++编译后就不知道咋办?如图,请会的朋友帮忙一下,可以详细讲解一下,最好有图,谢谢~~
/*编写一个计算乘幂的基于命令行的程序。
***第一个命令行参数为double类型数,作为幂的底数
****第二个参数为整数,作为幂的指数*/
/* Programming Exercise 11-13 */
#include <stdio.h>
#include <stdlib.h> /* for atof() */
#include <math.h> /* for pow() */
/* #include <console.h> */ /* Macintosh adjustment */
int main(int argc, char *argv[])
{
  double num, exp;
   
  /* argc = ccommand(&argv); */ /* Macintosh adjustment */  
  if (argc != 3)
  printf("Usage: %s number exponent\n", argv[0]);
  else
  {
  num = atof(argv[1]);
  exp = atof(argv[2]);
  printf("%f to the %f power = %g\n", num, exp, pow(num,exp));
  }
   
  return 0;
}


[解决办法]
在dos下输入 程序名 后面加 参数1,参数2。。。。。
如程序名叫 math 
先切换到这个目录,或者写全路径
在命令行下输入,math 11.11 2

热点排行
Bad Request.