+ 3

What is mistake in the program..

/* C++ Programming Examples */ #include<iostream.h> #include<conio.h> void main() { clrscr(); char str[20]; cout<<"Enter your name : "; cin>>str; cout<<"Hello, "<<str<<" Sir, You are at codescracker.com"; getch(); }

6th May 2017, 4:16 PM
Ehsan Mohammad
Ehsan Mohammad - avatar
6 odpowiedzi
+ 9
1. Use <iostream> instead of <iostream.h> as modern compilers don't support '.h' format 2. Remove #include <conio.h> as it is no more used. 3. Add a line using namespace std; before main (). 4. Remove clrscr () as not supported in modern compilers 5. Use getline (str,cin) instead of cin>>str in order to read multiple words string 6. Lastly remove getch ()
6th May 2017, 4:28 PM
देवेंद्र महाजन (Devender)
देवेंद्र महाजन (Devender) - avatar
+ 10
As for why your code isn't working: https://www.sololearn.com/Discuss/288609/?ref=app
6th May 2017, 4:53 PM
Hatsy Rei
Hatsy Rei - avatar
+ 8
Thanks @Serena for pointing out
6th May 2017, 4:31 PM
देवेंद्र महाजन (Devender)
देवेंद्र महाजन (Devender) - avatar
+ 2
thanks sir..
6th May 2017, 4:35 PM
Ehsan Mohammad
Ehsan Mohammad - avatar
0
#include <iostream.h> #include<conio.h> void main ( ) { clrscr( ); cout <<“Welcome to University of Engineering And Technology Taxila please solve this
6th Oct 2020, 5:25 PM
siraj Ahmad