Please guys I need some help here , how can I make a text or a string blink in C++ and in C also ?! And thanks anyways ! | Sololearn: Learn to code for FREE!
Novo curso! Todo programador deveria aprender IA generativa!
Experimente uma aula grƔtis
0

Please guys I need some help here , how can I make a text or a string blink in C++ and in C also ?! And thanks anyways !

12th Feb 2017, 11:14 PM
Muhammad Fouad Al-Haroon
Muhammad Fouad Al-Haroon - avatar
6 Respostas
0
while(true) { cout << "blinking text"; system("cls"); // stdlib.h Sleep(1000); // only for windows - windows.h }
13th Feb 2017, 1:33 AM
Nikunj Arora
Nikunj Arora - avatar
0
I have an error while building and running that says : "[Error] 'sleep' was not declared in this scope" !!
13th Feb 2017, 9:02 AM
Muhammad Fouad Al-Haroon
Muhammad Fouad Al-Haroon - avatar
0
you need to be on windows and include the header file "windows.h"
13th Feb 2017, 12:42 PM
Nikunj Arora
Nikunj Arora - avatar
0
I'm on windows actually , and I just typed the code typically , but it got me that error I mentioned earlier ! do you know what is the reason ?!
13th Feb 2017, 12:46 PM
Muhammad Fouad Al-Haroon
Muhammad Fouad Al-Haroon - avatar
0
you need to type this code in the main method. you need a modern compiler (basically anything except turbo c compilers). if it still doesn't work then I'm not really sure what else to do.. edit - you could also replace the sleep function with a for loop like this- for(int i = 0; i < 99999; i++); this basically eats away the memory and causes a delay. play around with the i < value and see what fits your need.
13th Feb 2017, 12:52 PM
Nikunj Arora
Nikunj Arora - avatar
0
@Nikunj Arora thank you anyways , and sorry for bothering you šŸ˜Š
13th Feb 2017, 7:18 PM
Muhammad Fouad Al-Haroon
Muhammad Fouad Al-Haroon - avatar