mistake in it

it doesn’t compile the program

the compiler show 2 errors in it

errors in bracket(C:\Users\DELL\Desktop\N WORK\Programs(C++)\sum2.cpp:5: error: `clrscr’ undeclared (first use this function)

C:\Users\DELL\Desktop\N WORK\Programs(C++)\sum2.cpp:5: error: (Each undeclared identifier is reported only once for each function it appears in.))

int main()
    clrscr () ;
    int value1, value2, sum ;
    cout<<"enter value1: " ;
    cin>>value1 ;
    cout<<"enter value2: " ;
    cin>>value2 ;
    sum =value1+value2 ;
    cout<<"the sum is: " <<sum <<endl;
    return 0 ;

Omit the space when u call the function clrscr()

Try to be clearer when you write the title of your question. And the question, don’t just copypaste everything, you can try that with Google and it will probably help you

When you write code, you have to write 4 spaces before the code. The result looks like

int main(){
   do something();
1 Like

-1 for ugly post! Follow the rules


You are correct, instead of typing spaces one can press “code sample” button (and editor adds spaces and line before and after, if missing).

1 Like