+ 2

What is the mistake ? Specific in the second line

#include <iostream> #include <conio> using namespace std; int main() { int x ,y ,sum; cout<< "enter value x"; cin>> x; cout<<"enter value y"; cin>> y; sum=x+y; cout<<"the sum =" <<sum; getch(); return 0; }

13th Sep 2023, 5:37 AM
Basma
8 odpowiedzi
+ 4
Then enter the input like this: 10 20 Then you see the output
13th Sep 2023, 6:08 AM
Sakshi [Offline 🙃]
Sakshi [Offline 🙃] - avatar
+ 3
Don't use: getch() and #include<conio>
13th Sep 2023, 5:51 AM
Sakshi [Offline 🙃]
Sakshi [Offline 🙃] - avatar
+ 3
@Sakshi, Can you please give a bit more information why we should not use getch() and #include<conio> ? Thanks!
13th Sep 2023, 11:11 AM
sandra
sandra - avatar
+ 2
Basma , Since as in Turbo C++ IDE only we use this format of including #include<conio.h>...which is older one... In modern compilers there is no need for it ...
13th Sep 2023, 11:44 AM
Riya
Riya - avatar
+ 2
sandra as Riya sis #include<conio.h> is older one and there is no need in compliers and getch() is also not include because user already return then why we use getch.
13th Sep 2023, 12:31 PM
Sakshi [Offline 🙃]
Sakshi [Offline 🙃] - avatar
13th Sep 2023, 12:48 PM
**🇦🇪|🇦🇪**
**🇦🇪|🇦🇪** - avatar
+ 1
Victoria Mostova , thanks for your helpful information concerning the use of <conio.h>. now i understand.
23rd Sep 2023, 7:44 AM
sandra
sandra - avatar