getch() & clrscr() errors

Go down

getch() & clrscr() errors

Post by jennyinhere on 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 : 30

View user profile

Back to top Go down

Re: getch() & clrscr() errors

Post by Christopher on 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.
avatar
Christopher
Admin

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

View user profile http://unixcpp.forumotion.com

Back to top Go down

Back to top

- Similar topics

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