zaracattle
07-07-2006, 10:20 AM
I installed DEv-C++ 5.0,but when I pressed F9 to run ,the program has some errors that I can't understand why??Even though my code is true.Other codes have the same errors.Ex:
#include <stdio.h>
#include <iostream.h>
#include <conio.h>
class Count{
public:
int x;
void print (){cout << x << endl;}
};
void main(){
Count counter,
*counterPtr = &counter,
&counterRef = counter;
cout<<"Gan 7 den x va insu dung ten cua doi tuong";
counter.x = 7;
counter.print();
cout<<"Gan 8 den x va in su dung 1 tham khao";
counterRef.x=8;
counterRef.print();
cout<<"Gan 10 den x va in su dung 1 con tro";
counterPtr -> x =10;
counterPtr -> print();
getch();
}
When I compile it ,In the bottom table of program ,it informed that "In file included from C:\Dev-Cpp\include\c++\3.4.2\backward\iostream.h:31, from bai2.cpp(title of program) , this information(may be no important: "#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. " And a lots of other errors... like "main must return int",...
In the first time ,when I compiled this program ,it still ran well,but after that I closed this program,when I opened Dev-C++ again then it didn't work.I don't understand why??I checked the path of include,lib,bin, it is true,no problem.Anybody has way to fix it,please show me,thanks very much!!!!!
#include <stdio.h>
#include <iostream.h>
#include <conio.h>
class Count{
public:
int x;
void print (){cout << x << endl;}
};
void main(){
Count counter,
*counterPtr = &counter,
&counterRef = counter;
cout<<"Gan 7 den x va insu dung ten cua doi tuong";
counter.x = 7;
counter.print();
cout<<"Gan 8 den x va in su dung 1 tham khao";
counterRef.x=8;
counterRef.print();
cout<<"Gan 10 den x va in su dung 1 con tro";
counterPtr -> x =10;
counterPtr -> print();
getch();
}
When I compile it ,In the bottom table of program ,it informed that "In file included from C:\Dev-Cpp\include\c++\3.4.2\backward\iostream.h:31, from bai2.cpp(title of program) , this information(may be no important: "#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. " And a lots of other errors... like "main must return int",...
In the first time ,when I compiled this program ,it still ran well,but after that I closed this program,when I opened Dev-C++ again then it didn't work.I don't understand why??I checked the path of include,lib,bin, it is true,no problem.Anybody has way to fix it,please show me,thanks very much!!!!!