0
why i am getting the output of previous code of c++
c++ in dev programing software
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.
+ 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;
}
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.
:)
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++
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.
- 1
Try including #include<conio.h>
And use clrscr() at the start of main()