tuanmaanh

New Member
Mình có viết 1 doạn :




Quote:













#include


#include


#include


#include


#include


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&&q)<<" "<<(p||q)<<" "<<(!(p==q))<<" "<<((!(p))||q)<<" "<<(p==q);


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




Quote:













Compiler: 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 header for the header for C++ includes, or instead of the deprecated header . 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






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 ấy
 

junte_luze

New Member
mình củng đang tìm hiểu về nó đây vừa thử chạy nhưng cũng không 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ì chỉ dẫn cho mình liên lạc yahoo nhé: nick của mình cho_toi_mot_chut
 

Quote:















Được gửi bởi vns_dah_keke





Mình có viết 1 doạn :














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 ấy











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


#include


#include


#include


#include


//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&&q)<<" "<<(p||q)<<" "<<(!(p==q))<<" "<<((!(p))||q)<<" "<<(p==q);


system("pause");


}
 

gifts_for_nemo

New Member
bạn làm lại thế này nhé:





#include

#include

#include

#include

#include

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&&q)<<" "<<(p||q)<<" "<<(!(p==q))<<" "<<((!(p))||q)<<" "<<(p==q);

system ("pause");

return 0;

}



thế là oke nó chạy liền à
 

pe_pe

New Member
#include

#include

#include

// 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 laptop 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 Thank nhiu...
 

hoanghuyhung

New Member
eh..TRONG DEV C++ KHÔNG CHO PHEP DUNG VOID MAIN() CHI DUNG MAIN() THOI
VÀ KHÔNG DUOC DUNG XOA MAN HINH/........CÓ LÀM RUỘNG SẼ CÓ RƠM......GỌN HƠN LÀ(clrscr())...hề hề......

tạo màu chũ trong dev c++ cung không duoc phep....

neu co duoc phep thi co cai thu vien do hoa vao moi duoc... cai ay chua tim hieu nen chua ro.;;;; tu di tim hieu di.....
 

Các chủ đề có liên quan khác

Top