Unix C++
Would you like to react to this message? Create an account in a few clicks or log in to continue.

getch() & clrscr() errors

2 posters

Go down

getch() & clrscr() errors Empty getch() & clrscr() errors

Post by jennyinhere Fri Feb 26, 2010 7:23 pm

#include <iostream.h>
int main()
{
clrscr();
int x,y,sum;
float average;
cout << "Enter 2 integers : " << endl;
cin>>x>>y;
sum=x+y;
average=sum/2;
cout << "The sum of " << x << " and " << y << " is " << sum << "." << endl;
cout << "The average of " << x << " and " << y << " is " << average << "." << endl;
getch();
}

----------------------------
..\world.cpp:14: error: `getch' was not declared in this scope
..\world.cpp:5: warning: unused variable 'clrscr'
..\world.cpp:14: warning: unused variable 'getch'

jennyinhere

Posts : 24
Points : 30
Join date : 2010-02-26
Age : 35

Back to top Go down

getch() & clrscr() errors Empty Re: getch() & clrscr() errors

Post by Christopher Fri Feb 26, 2010 11:43 pm

getch() and clrscr() are part of conio.h header file. conio.h is used in old MS-DOS compilers to create text user interfaces but not a part of standard c library. So if u r using "MinGW" or "Cygwin" compilers, they wont support these functions.
Christopher
Christopher
Admin

Posts : 240
Points : 429
Join date : 2010-02-26
Age : 35

https://unixcpp.forumotion.com

Back to top Go down

Back to top


 
Permissions in this forum:
You cannot reply to topics in this forum