+ 1

Hello Guys , How to remove the blink when using System("cls") in c Language??? Thank you for responding 😍

I have a calcu program where you can select an operation you desired by pressing corresponding key on the keyboard (A-addition , B-subtraction, C-Multiplication, D-division,E- exist) my problem is. the screen is blinking which like a restart effect when you press an invalid key..yes the program will sense if your key is invalid and it will display " invalid key" but the screen musn't blink and then invalid statement will disappear. without showing any blink or restart effect. thanks for the help guys love u

3rd Jan 2018, 3:22 PM
Xert
Xert - avatar
1 Answer
0
U can use std::cout<<std::string(100,"\n"); to clear the screen instead of system("CLS"). But if u have used a "cout" statement before it, output gets cleared in blink of an eye without staying in the output screen.So,u can use a getch() or system("pause") function before clearing the screen, which will wait for a user input to proceed to execution of next line in the program. So the program may look like. if(invalid key) {cout<<"invalid key"; system("pause"); std::cout<<std::string(100,"\n"); }
5th Jan 2018, 3:33 PM
Yeshwanth.R