How to clear a text after another? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 2

How to clear a text after another?

6th Nov 2016, 5:35 AM
Leon lit
Leon lit - avatar
7 Answers
+ 3
use clrscr(); function it erases the CMD screen.
6th Nov 2016, 7:57 AM
Sandeep Chatterjee
+ 3
yes let's see it #include <iostream.h > #include <conio.h> void main(){ char a; cout<<"this is the message press any key to remove"; cin>>a; clrscr() ; // now you have a cleared screen }
6th Nov 2016, 8:16 AM
Sandeep Chatterjee
+ 3
#include <iostream> #include <windows.h> using namespace std; int main(){ cout<<"Hello"; system("pause"); system("cls"); return 0; } However, my method only works if you compile the code in an Windoww environment.
6th Nov 2016, 8:52 AM
Mihai Dancaescu
Mihai Dancaescu - avatar
+ 1
could you explain how to use it.
6th Nov 2016, 8:14 AM
Leon lit
Leon lit - avatar
0
#include <iostream> using namespace std; int main() { int age; cout <<"How old are you.\n"; cin >> age; (how to clear the word (How old are you) after the input?) if(age <= 16) { cout <<"You are too young\n"; cout <<"grow up and become a person xD !!!"; } else if(age >= 17 && age <= 41) { cout << "you are an teenager\n"; cout << "apreciate your precious time !!!"; } else if(age >= 42 && age <= 69) { cout << "you are an adult\n"; cout << "take a good care of your health !!!"; } else if(age >= 70) { cout << "you are an elder\n"; cout <<"time past with an blink of eye right. !!!"; } return 0; }
6th Nov 2016, 8:21 AM
Leon lit
Leon lit - avatar
0
ok thanks :D
6th Nov 2016, 8:43 AM
Leon lit
Leon lit - avatar
0
ok thanks for your explanation :D
6th Nov 2016, 9:05 AM
Leon lit
Leon lit - avatar