Hiển thị kết quả từ 1 đến 6 / 6
-
30-05-2007 15:12 #1
Xin hướng dẫn cách sử dụng Dev-C++ , hix hix
Mình có viết 1 doạn :
#include<conio.h>
#include<stdio.h>
#include<stdlib.h>
#include<math.h>
#include<iostream.h>
void main()
{
clrscr();
int p[5],q[5];
p[1]=p[2]=q[1]=q[3]=1;
p[3]=p[4]=q[2]=q[4]=0;
cout<<"P Q (P and Q) (P or Q) (P xor Q) (P -> Q) (P <-> Q) ";
for(int i=1;i<=4;i++)
cout<<"\n\n"<<p[i]<<" "<<q[i]<<" "<<(p[i]&&q[i])<<" "<<(p[i]||q[i])<<" "<<(!(p[i]==q[i]))<<" "<<((!(p[i]))||q[i])<<" "<<(p[i]==q[i]);
getch();
}
Viết trong TC thì khi nhấn CTRL + F9 thì chuơng trình chạy bình thường, hok có 1 lỗi nào , Nhưng khi vào trong Dev-C++ thì nó báo 1 đống lỗi
Hix, ai biết xin chỉ mình với . Hình như cái này là lỗi chưa khai báo thư viện hay seo ấyCompiler: Default compiler
Executing g++.exe...
g++.exe "E:\hoctap\cpp\BAI1.CPP" -o "E:\hoctap\cpp\BAI1.exe" -I"C:\Dev-Cpp\lib\gcc\mingw32\3.4.2\include" -I"C:\Dev-Cpp\include\c++\3.4.2\backward" -I"C:\Dev-Cpp\include\c++\3.4.2\mingw32" -I"C:\Dev-Cpp\include\c++\3.4.2" -I"C:\Dev-Cpp\include" -L"C:\Dev-Cpp\lib"
In file included from C:/Dev-Cpp/include/c++/3.4.2/backward/iostream.h:31,
from E:\hoctap\cpp\BAI1.CPP:5:
C:/Dev-Cpp/include/c++/3.4.2/backward/backward_warning.h:32:2: warning: #warning This file includes at least one deprecated or antiquated header. Please consider using one of the 32 headers found in section 17.4.1.2 of the C++ standard. Examples include substituting the <X> header for the <X.h> header for C++ includes, or <iostream> instead of the deprecated header <iostream.h>. To disable this warning use -Wno-deprecated.
E:\hoctap\cpp\BAI1.CPP:7: error: `main' must return `int'
E:\hoctap\cpp\BAI1.CPP: In function `int main(...)':
E:\hoctap\cpp\BAI1.CPP:8: error: `clrscr' undeclared (first use this function)
E:\hoctap\cpp\BAI1.CPP:8: error: (Each undeclared identifier is reported only once for each function it appears in.)
E:\hoctap\cpp\BAI1.CPP:16:2: warning: no newline at end of file
Execution terminated
-
23-12-2007 07:20 #2
Registered User
- Tham gia
- 13-07-2007
- Bài viết
- 8
- Like
- 0
- Thanked 0 Times in 0 Posts
mình củng đang tìm hiểu về nó đây đã thử chạy nhưng cũng ko ok cho lắm. Không biết bị lỗi chỗ nào bạn mà biết cách sử dụng Dev-C thì hướng dẫn cho mình liên lạc yahoo nhé: nick của mình cho_toi_mot_chut
-
16-10-2008 08:23 #3
Registered User
- Tham gia
- 13-10-2007
- Bài viết
- 4
- Like
- 0
- Thanked 0 Times in 0 Posts
bạn làm theo cách này nhá.vì môi trường biên dịch của Dev C++ khác với Tuborr C++. Bài này mình text rồi.chạy được rồi đấy
#include<conio.h>
#include<stdio.h>
#include<stdlib.h>
#include<math.h>
#include<iostream.h>
//using namespace std;
int main()
{
int p[5],q[5];
p[1]=p[2]=q[1]=q[3]=1;
p[3]=p[4]=q[2]=q[4]=0;
cout<<"P Q (P and Q) (P or Q) (P xor Q) (P -> Q) (P <-> Q) ";
for(int i=1;i<=4;i++)
cout<<"\n\n"<<p[i]<<" "<<q[i]<<" "<<(p[i]&&q[i])<<" "<<(p[i]||q[i])<<" "<<(!(p[i]==q[i]))<<" "<<((!(p[i]))||q[i])<<" "<<(p[i]==q[i]);
system("pause");
}
-
05-06-2009 00:05 #4
Registered User
- Tham gia
- 09-12-2007
- Bài viết
- 1
- Like
- 0
- Thanked 0 Times in 0 Posts
bạn làm lại thế này nhé:
#include<iostream>
#include<conio.h>
#include<stdio.h>
#include<stdlib.h>
#include<math.h>
using namespace std;
main()
{
int p[5],q[5];
p[1]=p[2]=q[1]=q[3]=1;
p[3]=p[4]=q[2]=q[4]=0;
cout<<"P Q (P and Q) (P or Q) (P xor Q) (P -> Q) (P <-> Q) ";
for(int i=1;i<=4;i++)
cout<<"\n\n"<<p[i]<<" "<<q[i]<<" "<<(p[i]&&q[i])<<" "<<(p[i]||q[i])<<" "<<(!(p[i]==q[i]))<<" "<<((!(p[i]))||q[i])<<" "<<(p[i]==q[i]);
system ("pause");
return 0;
}
thế là oke nó chạy liền à
-
06-04-2010 13:06 #5
Registered User
- Tham gia
- 08-03-2010
- Bài viết
- 6
- Like
- 0
- Thanked 1 Time in 1 Post
#include <stdio.h>
#include<math.h>
#include<conio.h>
// Ham tinh.
//using namespace std;
int tinh(int x, int y, int z){
float x1, x2, X;
float d;
d = y*y - 4*x*z;
if (d < 0) {
printf("- phuong trinh vo nghiem !");
printf("\n\n");
}
else {
if(d > 0) {
x1 = (-y - sqrt(d)) / (2*x);
x2 = (-y + sqrt(d)) / (2*x);
printf("- phuong trinh co hai nghiem phan biet !");
printf("\n\n\n");
printf("x1 = %f",(-y - sqrt(d)) / (2*x));
printf("\n\n\n");
printf("x2 = %f",(-y + sqrt(d)) / (2*x));
printf("\n\n\n");
}
else {
X = -y / (2*x);
printf("phuong trinh co nghiem kep !");
printf("\n\n\n");
printf("X = %6.1d",-y / (2*x));
}
}
return 0;
}
int main() {
int a, b, c;
char ch;
puts("Giai phuong trinh bac hai co su dung function !");
do{
//Phai dua vao vong lap hoac theo anh la dua vao function tinh()
printf("\n\n\n");
printf("nhap so a : ");
scanf("%d",&a);
printf("\n\n\n");
printf("nhap so b : ");
scanf("%d",&b);
printf("\n\n\n");
printf("nhap so c : ");
scanf("%d",&c);
//=====================================-=======================================
printf("\n");
tinh(a, b, c); // loi goi ham.
printf("\n");
printf("Bam 'Y' hoac 'y' de tiep tuc Bam 'n' de thoat ! \t");
ch = _getch(); // Dung ham nay!
putchar (ch); // in ra man hinh ky tu vua nhap.
printf("\n\n\n");
} while(ch == 'Y' || ch == 'y');
return 0;
}
em co bai nay cung chay tren Dev-C++ 4.9.9.2. Nhung cung khong chay dc no bao loi la "Sourse file not compiled" ma trong khi do em chay tren C-Free thi lai khong co van de gi?==>>anh nao biet chi cho em hieu ra cai van de nay nhe ! em cam on nhiu...
-
Thành viên Like bài viết này:
-
16-05-2010 17:51 #6
Registered User
- Tham gia
- 28-10-2009
- Bài viết
- 4
- Like
- 0
- Thanked 0 Times in 0 Posts
cam ơn
cam on may ban, do trong devc++ ko dung getch vơi clrscr do ma




Bookmarks