注册 登录
编程论坛 C++教室

一个关于dev C++的问题

lehaihua444 发布于 2007-08-25 14:07, 1526 次点击

我昨天刚下载了dev C++ 4.9.9.2, 可是不知道为什么什么都运行不了,是不是软件里面要设置什么啊?
我按照书本里面一些简单的code打也运行不了,那黑色匡出现了一下就没了,我按照论坛里面一些正确的code 打了一片也不行,究竟为什么阿?
我用的是英文版,先按file-->new-->source file-->然后打code-->compile-->run
这样子错了吗?还是有设置什么?

我按照书本的code是这样的:
#include <stdio.h>
#include <math.h>

int main (void)
{
double x1=1, y1=5, x2=4, y2=7, side1, side2, distance;

side1 = x2 - x1;
side2 = y2 - y1;
distance = sqrt(side1*side1 + side2*side2);

printf("the distance between the two points is:""%5.2f \n", distance);

return 0;
}
就是显示不了。。。希望高手解答!!!

10 回复
#2
远去的列车2007-08-25 14:09
先要建立一个project
#3
lehaihua4442007-08-25 14:12
先建project--&gt;empty project--&gt; c++ project--&gt;然后new file--&gt;在打,还是不行。。。哭。。。
#4
yuyunliuhen2007-08-25 14:16

#include <iostream>
#include <cmath>
using namespace std;

int main (void)
{
double x1=1, y1=5, x2=4, y2=7, side1, side2, distance;

side1 = x2 - x1;
side2 = y2 - y1;
distance = sqrt(side1*side1 + side2*side2);

printf("the distance between the two points is:""%5.2f \n", distance);

return 0;
}
试试!

#5
lehaihua4442007-08-25 14:29
先谢谢2楼和4楼的帮忙,
可是还是不行。。。==!
#6
青格儿2007-09-05 14:22
加一句:system("pause");

#include<iostream>
#include <stdio.h>
#include <math.h>

int main ()
{
double x1=1, y1=5, x2=4, y2=7, side1, side2, distance;

side1 = x2 - x1;
side2 = y2 - y1;
distance = sqrt(side1*side1 + side2*side2);

printf("the distance between the two points is:""%5.2f \n", distance);

system("pause");


return 0;


}
#7
福尔摩斯2007-09-05 14:29
C语言程序在return前加getch();

++语言程序在return前加cin.get();(如果有输入语句cin的,要再加条cin.get())
#8
天使梦魔2007-09-05 16:11
DEV的编译器你新建个工程,第2页有个win16示范。

或者自己做个段点
int a;cin>>a;
#9
duffebear2007-09-06 10:26

单个文件不需要建工程

#include <iostream>
#include <cmath>
using namespace std;

int main (void)
{
double x1=1, y1=5, x2=4, y2=7, side1, side2, distance;

side1 = x2 - x1;
side2 = y2 - y1;
distance = sqrt(side1*side1 + side2*side2);

cout<<"the distance between the two points is:"<<distance;
system("pause");
return 0;
}

我编译运行都很好,没有问题

#10
PcrazyC2007-09-06 13:28
#include <stdio.h>
#include <math.h>
#include <conio.h>
int main (void)
{
double x1=1, y1=5, x2=4, y2=7, side1, side2, distance;

side1 = x2 - x1;
side2 = y2 - y1;
distance = sqrt(side1*side1 + side2*side2);

printf("the distance between the two points is:""%5.2f \n", distance);
getch();
return 0;
}

或者:

#include <stdio.h>
#include <math.h>
#include <stdlib.h>
int main(void)
{
double x1=1, y1=5, x2=4, y2=7, side1, side2, distance;

side1 = x2 - x1;
side2 = y2 - y1;
distance = sqrt(side1*side1 + side2*side2);

printf("the distance between the two points is:""%5.2f \n", distance);
system("pause");
return 0;
}
#11
virusswb2007-09-06 14:46
#include <stdio.h>
#include <cstdlib>
#include <math.h>

int main ()
{
double x1=1, y1=5, x2=4, y2=7, side1, side2, distance;

side1 = x2 - x1;
side2 = y2 - y1;
distance = sqrt(side1*side1 + side2*side2);

printf("the distance between the two points is:""%5.2f \n", distance);
system("pause");
return 0;

}

1