0

why i am getting the output of previous code of c++

c++ in dev programing software

11th Nov 2019, 4:04 AM
Ravi Henry
Ravi Henry - avatar
6 Respuestas
+ 2
Compile your code first then run it. If you compiled the code and then running it. Want to tell you that there is a little bug in dev c++, which gives you previously compiled output, because you paste the code in same file (re-write). Just close dev c++ write your code in new C++ file then you'll get output.
11th Nov 2019, 5:01 AM
Chirag Kumar
Chirag Kumar - avatar
+ 1
thx chirag finally got the output. and <conio.h> is supported in dev++ bro RUN THAT CODE AND SEE:-- #include <iostream> #include <conio.h> using namespace std; class company { int id; char name[20]; char dep[20]; public: void getdata(); void display(); }; void company :: getdata() { cout<<"/ENTER YOUR ID:"; cin>>id; cout<<"/ENTER YOUR NAME:"; cin>>name; cout<<"/ENTER YOUR DEPARTMENT"; cin>>dep; } void company :: display() { cout<<"YOUR ID:"<<id<<endl; cout<<"YOUR NAME:"<<name<<endl; cout<<"YOUR DEPARTMENT:"<<dep<<endl; getch (); } int main() { company manager[3],teamlead[5]; for (int i=0;i<3;i++) { cout<<"/ENTER DETAILS OF MANAGER:"; manager[i].getdata(); } for (int i=0;i<5;i++) { cout<<"/ENTER DETAILS OF TEACHER:"; teamlead[i].display(); } for(int i=0;i<3;i++) { cout<<"/nDetails of Manager:"<<i+1; manager[i].display(); } for(int i=0;i<5;i++) { cout<<"/nDetails of Manager:"<<i+1; teamlead[i].display(); } return 0; }
12th Nov 2019, 2:21 AM
Ravi Henry
Ravi Henry - avatar
0
Rohit Singh In dev c++ there is no support of conio.h. Because conio.h isn't the standard library in c++. It will gives you only error if you include conio.h you can try. :)
11th Nov 2019, 7:40 AM
Chirag Kumar
Chirag Kumar - avatar
0
Ravi Henry conio.h isn't a standard library in c++ if you won't get error than it might be the compiler you are using is MSDOS c++ complier. But in gcc/g++ compiler which is used widely than MSDOS there is no support of conio.h and clrscr(). For using clrscr() u need to use system.h as header file and system("cls") as line of code to clear screen. Read this : https://www.quora.com/How-can-I-add-conio-h-in-Dev-C++
12th Nov 2019, 2:42 AM
Chirag Kumar
Chirag Kumar - avatar
0
i was getting the same "error" until i deleted all c++ files i had, fortunately it wast so many c++ files, only about 14 files.
11th Sep 2023, 3:29 AM
benjamin salvatierra
benjamin salvatierra - avatar
- 1
Try including #include<conio.h> And use clrscr() at the start of main()
11th Nov 2019, 6:08 AM
Rohit Singh
Rohit Singh - avatar