Answer for 1:
#include <iostream>
#include <conio.h>
#include <windows.h>
using namespace std;
int main(int argc, char** argv)
{
int x,y,i;char name[10];
textcolor(10);
x=wherex();y=wherey(); //corrdinates of caret will be stored in x & y.
cout<<"\t\t\t\tWelcome\n";
textcolor(15);
cout<<"\nEnter your name\n";
gets(name);
while(1)
{
for(i=10;i<15;i++)
{
textcolor(i);
gotoxy(x,y); //Transferring caret to the coordinates stored in x & y.
cout<<"\t\t\t\tWelcome";
Sleep(300);
}
}
return 0;
}
Answer for 2:
#include <windows.h>
#include <stdio.h>
#include <conio.h>
HANDLE hStdout;
int ScrollByAbsoluteCoord(int iRows)
{
CONSOLE_SCREEN_BUFFER_INFO csbiInfo;
SMALL_RECT srctWindow;
// Get the current screen buffer size and window position.
if (! GetConsoleScreenBufferInfo(hStdout, &csbiInfo))
{
printf("GetConsoleScreenBufferInfo (%d)\n", GetLastError());
return 0;
}
// Set srctWindow to the current window size and location.
srctWindow = csbiInfo.srWindow;
// Check whether the window is too close to the screen buffer
top
if ( srctWindow.Top >= iRows )
{
srctWindow.Top -= (SHORT)iRows; // move top up
srctWindow.Bottom -= (SHORT)iRows; // move bottom up
if (! SetConsoleWindowInfo(
hStdout, // screen buffer handle
TRUE, // absolute coordinates
&srctWindow)) // specifies new location
{
printf("SetConsoleWindowInfo (%d)\n", GetLastError());
return 0;
}
return iRows;
}
else
{
printf("\nCannot scroll; the window is too close to the
top.\n");
return 0;
}
}
int ScrollByRelativeCoord(int iRows)
{
CONSOLE_SCREEN_BUFFER_INFO csbiInfo;
SMALL_RECT srctWindow;
// Get the current screen buffer window position.
if (! GetConsoleScreenBufferInfo(hStdout, &csbiInfo))
{
printf("GetConsoleScreenBufferInfo (%d)\n", GetLastError());
return 0;
}
// Check whether the window is too close to the screen buffer
top
if (csbiInfo.srWindow.Top >= iRows)
{
srctWindow.Top =- (SHORT)iRows; // move top up
srctWindow.Bottom =- (SHORT)iRows; // move bottom up
srctWindow.Left = 0; // no change
srctWindow.Right = 0; // no change
if (! SetConsoleWindowInfo(
hStdout, // screen buffer handle
FALSE, // relative coordinates
&srctWindow)) // specifies new location
{
printf("SetConsoleWindowInfo (%d)\n", GetLastError());
return 0;
}
return iRows;
}
else
{
printf("\nCannot scroll; the window is too close to the
top.\n");
return 0;
}
}
int main( void )
{
int i;
printf("\nPrinting twenty lines, then scrolling up five
lines.\n");
printf("Press any key to scroll up ten lines; ");
printf("then press another key to stop the demo.\n");
for(i=0; i<=20; i++)
printf("%d\n", i);
hStdout = GetStdHandle(STD_OUTPUT_HANDLE);
if(ScrollByAbsoluteCoord(5))
_getch();
else return 0;
if(ScrollByRelativeCoord(10))
_getch();
else return 0;
}
Thanks
Write two C++ programs. 1, When we write a message then this message blinking out the...
MAC 102 Quiz 2 Write a C++ programs to: 1. (2 points) receive two numbers from the keyboard, 2. (3 points) save these two numbers in an array of two elements, 3. (3 points) use a function to swap them, 4. (2 points) display the contents of the array (swapped) on the screen with proper message. You need to email your program to geney@lagcc.cuny.edu no later than 3 pm. Please include your name, quiz #2, MAC102 in the email's subject...
1. Design a blinking LED with two speeds - slow and fast. (BASYS 3) (IN VIVADO) Specification To change from slow to fast press Button 1 and fast to slow press Button 2. Reset puts the machine to slow blinking. entity blink is port (b1, b2, ck, reset: in std_logic; z: out std_logic); end blink;
arduino : write a function that print out on the lcd screen the following message hello world please use function
//Done in C please!
//Any help appreciated!
Write two programs to write and read from file the age and first
and last names of people. The programs should work as follows:
1. The first program reads strings containing first and last
names and saves them in a text file (this should be done with the
fprintf function). The program should take the name of the file as
a command line argument. The loop ends when the user enters 0, the...
requirements
write c++ code for the above programs use only 1D arrays with loops
and if else statement don't use any other way as it would be
useful
Answer all four parts with comments for better
understanding
A top-secret message containing letters from A-Z is encoded to numbers using the following mapping: A -> 1 B- 2 Z-> 26 You are a SPY. You have to determine the total number of ways that message can be decoded. Note: An empty...
Blinking Printer Lights You are experiencing the problem of blinking lights with your HP DeskJet 920C printer: The Power light blinks but the Cartridge & Resume lights are off. This happens when the printer is NOT currently processing a print job. Go to www.hp.com, and consult their knowledgebase to find out how to solve this problem. Use a time-piece to track precisely how long it takes from the moment the hp home page loads until the solution is found. 1....
Write in Java! Do NOT write two different programs for Deck and Card, it should be only one program not 2 separate ones!!!!!! The Learning Goal for this exercise is to use and understand and know the difference between arrays and array lists. !!!!Use at least one array defined in your code and two array lists defined by the operation of your code!!!! The array should be 52 elements and contain a representation of a standard deck of cards, in...
Write in C: 1.) Write an if/else statement that adds 1 to the variable minors if the variable age is less than 18, adds 1 to the variable adults if age is 18 through 64, and adds 1 to the variable seniors if age is 65 or older. 2.) Write a statement that compares the values of score1 and score2 and takes the following actions. When score1 exceeds score2, the message "player1 wins" is printed to standard out. When score2...
In C++, Write two programs to count the number of consonants in a string. One will use an iterative method and one will use a recursive method.
Using a Python environment, complete two small Python programs - Write a function which repeatedly reads numbers until the user enters “done” Once “done” is entered, print out the sum, average, maximum, and minimum of the values entered If the user enters anything other than a number, detect their mistake using try and except and print an error message and skip to the next number. 2. Write another function so that it draws a sideways tree pointing right; for example,...