VUsolutions Transferred to AchiKhasi.com

From December 2011, this blog www.VUsolutions.blogspot.com is transferred to http://achikhasi.com/vu/ . So, you may visit http://achikhasi.com/vu/ for latest study related help.

Back to home VUsolutions

VUsolutions Fans Club [join us for MORE solutions]

VUsolutions on Facebook

Cs609 Assignment No. 1 fall 2011 solution

Friday, October 28, 2011 Posted In Edit This
CS609 solution

change the names of variables if you can.
You can change color strips easily by just swapping ColorsArray elements.
you can also use a loop to show all 25 color strips and also this would be a good coding practice.its just and idea solution and work of 30 minutes. i recommend you to use loop like below
int i;
for(i = 0;i<25;i++){
//color strip code here
}
========

#include <stdio.h>
#include <windows.h>
char ColorsArray[] = {BACKGROUND_RED,BACKGROUND_GREEN,BACKGROUND_BLUE };
int main ( void )
{
HANDLE h = GetStdHandle ( STD_OUTPUT_HANDLE );
WORD wOldColorAttrs;
CONSOLE_SCREEN_BUFFER_INFO csbiInfo;
GetConsoleScreenBufferInfo(h, &csbiInfo);
wOldColorAttrs = csbiInfo.wAttributes;
SetConsoleTextAttribute ( h, ColorsArray[0] | BACKGROUND_INTENSITY );
printf ( " " );
SetConsoleTextAttribute ( h, ColorsArray[0] );
printf ( " " );
SetConsoleTextAttribute ( h, ColorsArray[1] | BACKGROUND_INTENSITY );
printf ( " " );
SetConsoleTextAttribute ( h, ColorsArray[1] );
printf ( " " );
SetConsoleTextAttribute ( h, ColorsArray[2] | BACKGROUND_INTENSITY );
printf ( " " );
SetConsoleTextAttribute ( h, ColorsArray[2] );
printf ( " " );
SetConsoleTextAttribute ( h, ColorsArray[0] | ColorsArray[1]| BACKGROUND_INTENSITY );
printf ( " " );
SetConsoleTextAttribute ( h, ColorsArray[0] | ColorsArray[1] );
printf ( " " );
SetConsoleTextAttribute ( h, ColorsArray[0] | ColorsArray[1]| ColorsArray[2] |
BACKGROUND_INTENSITY );
printf ( " " );
SetConsoleTextAttribute ( h, ColorsArray[0] | ColorsArray[1]| ColorsArray[2] );
printf ( " " );
SetConsoleTextAttribute ( h, ColorsArray[0] | ColorsArray[2] | BACKGROUND_INTENSITY );
printf ( " " );
SetConsoleTextAttribute ( h, ColorsArray[0] | ColorsArray[2] );
printf ( " " );
SetConsoleTextAttribute ( h, ColorsArray[1] | ColorsArray[2] | BACKGROUND_INTENSITY );
printf ( " " );
SetConsoleTextAttribute ( h, ColorsArray[1] | ColorsArray[2] );
printf ( " " );
SetConsoleTextAttribute ( h, ColorsArray[1] | BACKGROUND_INTENSITY );
printf ( " " );
SetConsoleTextAttribute ( h, ColorsArray[1] );
printf ( " " );
SetConsoleTextAttribute ( h, ColorsArray[2] | BACKGROUND_INTENSITY );
printf ( " " );
SetConsoleTextAttribute ( h, ColorsArray[2] );
printf ( " " );
SetConsoleTextAttribute ( h, ColorsArray[0] | ColorsArray[1]| BACKGROUND_INTENSITY );
printf ( " " );
SetConsoleTextAttribute ( h, ColorsArray[0] | ColorsArray[1]| ColorsArray[2] );
printf ( " " );
SetConsoleTextAttribute ( h, ColorsArray[0] | ColorsArray[2] | BACKGROUND_INTENSITY );
printf ( " " );
SetConsoleTextAttribute ( h, ColorsArray[0] | ColorsArray[2] );
printf ( " " );
SetConsoleTextAttribute ( h, ColorsArray[1] | ColorsArray[2] | BACKGROUND_INTENSITY );
printf ( " " );
SetConsoleTextAttribute ( h, ColorsArray[1] | ColorsArray[2] );
printf ( " " );
SetConsoleTextAttribute ( h, ColorsArray[1] | ColorsArray[0] );
printf ( " " );
SetConsoleTextAttribute ( h, wOldColorAttrs);
system("pause");
return 0;
}
:::::::::::::::::::::::::::::::



#include <stdio.h>
#include <windows.h>
char ColorsArray[] = {BACKGROUND_RED,BACKGROUND_GREEN,BACKGROUND_BLUE };
int main ( void )
{
HANDLE h = GetStdHandle ( STD_OUTPUT_HANDLE );
WORD wOldColorAttrs;
CONSOLE_SCREEN_BUFFER_INFO csbiInfo;
GetConsoleScreenBufferInfo(h, &csbiInfo);
wOldColorAttrs = csbiInfo.wAttributes;
SetConsoleTextAttribute ( h, ColorsArray[0] | BACKGROUND_INTENSITY );
printf ( "
" );
SetConsoleTextAttribute ( h, ColorsArray[0] );
printf ( "
" );
SetConsoleTextAttribute ( h, ColorsArray[1] | BACKGROUND_INTENSITY );
printf ( "
" );
SetConsoleTextAttribute ( h, ColorsArray[1] );
printf ( "
" );
SetConsoleTextAttribute ( h, ColorsArray[2] | BACKGROUND_INTENSITY );
printf ( "
" );
SetConsoleTextAttribute ( h, ColorsArray[2] );
printf ( "
" );
SetConsoleTextAttribute ( h, ColorsArray[0] | ColorsArray[1]| BACKGROUND_INTENSITY
);
printf ( "
" );
SetConsoleTextAttribute ( h, ColorsArray[0] | ColorsArray[1] );
printf ( "
" );
SetConsoleTextAttribute ( h, ColorsArray[0] | ColorsArray[1]| ColorsArray[2] |
BACKGROUND_INTENSITY );
printf ( "
" );
SetConsoleTextAttribute ( h, ColorsArray[0] | ColorsArray[1]| ColorsArray[2] );
printf ( "
" );
SetConsoleTextAttribute ( h, ColorsArray[0] | ColorsArray[2] |
BACKGROUND_INTENSITY );
printf ( "
" );
SetConsoleTextAttribute ( h, ColorsArray[0] | ColorsArray[2] );
printf ( "
" );
SetConsoleTextAttribute ( h, ColorsArray[1] | ColorsArray[2] |
BACKGROUND_INTENSITY );
printf ( "
" );
SetConsoleTextAttribute ( h, ColorsArray[1] | ColorsArray[2] );
printf ( "
" );
SetConsoleTextAttribute ( h, ColorsArray[1] | BACKGROUND_INTENSITY );


printf ( "
" );
SetConsoleTextAttribute ( h, ColorsArray[1] );
printf ( "
" );
SetConsoleTextAttribute ( h, ColorsArray[2] | BACKGROUND_INTENSITY );
printf ( "
" );
SetConsoleTextAttribute ( h, ColorsArray[2] );
printf ( "
" );
SetConsoleTextAttribute ( h, ColorsArray[0] | ColorsArray[1]| BACKGROUND_INTENSITY
);
printf ( "
" );
SetConsoleTextAttribute ( h, ColorsArray[0] | ColorsArray[1]| ColorsArray[2] );
printf ( "
" );
SetConsoleTextAttribute ( h, ColorsArray[0] | ColorsArray[2] |
BACKGROUND_INTENSITY );
printf ( "
" );
SetConsoleTextAttribute ( h, ColorsArray[0] | ColorsArray[2] );
printf ( "
" );
SetConsoleTextAttribute ( h, ColorsArray[1] | ColorsArray[2] |
BACKGROUND_INTENSITY );
printf ( "
" );
SetConsoleTextAttribute ( h, ColorsArray[1] | ColorsArray[2] );
printf ( "
" );
SetConsoleTextAttribute ( h, ColorsArray[1] | ColorsArray[0] );
printf ( "
" );
SetConsoleTextAttribute ( h, wOldColorAttrs);
system("pause");
return 0;
}

Back to home VUsolutions

Shaadi.com: Just create ur account & find ur partner or EARN money, its reall & EASY

VUsolutions Followers (Join NOW and Get Extra Benefits)

Install LATEST toolbar having lot of features - GET solutions on Desktop

toolbar powered by Conduit
Caliplus 300x250 NoFlam VitoLiv 468x60 GlucoLo