Computer Science C write a program to print white lowercase
Computer Science C++
write a program to print white lowercase ‘o’s on a black background across the middle of the screen.
Next, have a capital ‘O’ move from left to right, and back, on top of the lower-case ‘o’s using each of the colors specified by the ANSCI escape sequences.
After you’ve “bounced” a white ‘O’, go to the next line and end your program.
#include Kiostream> Add this line to your coded #include using namespace std; Add this function to your code void pause int milliseconds int limit clock milliseconds CLOCKS PER SEC 1000; while clock limit Do nothing just wait Here is how you use it. int main() cout Waiting 2 sec flush. Need flush to see this before pause pause (2000) cout Done endl endl;Solution
write a program to print white lowercase ‘o’s on a black background across the middle of the screen.
//now to print o across the middle of the screen
//middle of the screen will be (x,12.5) i.e print o across alll x on the 12.5 yth coordiante.
gotoxy(0,12.5); //start printing from here.
for(int i = 0; i<80;i++)
cout<<\"o \";
return 0;
}
----------
to do this first print O then pause then use \\b to delete it then pause then print O on the next coordinate
//code
*include this after the cout<<\"o\" in the above code*
//move big O from left to right at the bottom of the window
#include <windows.h>
void setColor(int value) {
SetConsoleTextAttribut(GetStdHandle(STD_OUTPUT_HANDLE), value);
}
for(i = 0 ; i<80;i++)
{
gotoxy(i,25);
setColor(rand()%16); //0 - Blue ... 15 -white
cout<<\"O\";
pause(1000);
cout<<\\b;
pause(1000);
}
//move it from bottom left corener to top
for(i = 25; i>=0; i--)
{
gotoxy(80,i);
setColor(rand()%16);
cout<<\"O\";
pause(1000);
cout<<\\b;
pause(1000);
}
cout<<\ ; //to jump to next line
*similarly do for right to left and top to bottom*
--------------------
thank you
-----------------------

