Beruflich Dokumente
Kultur Dokumente
FLOWCHART: START
Prompt user to
select a choice
If a<20; a++
case a<19;a++
a<20;a++
a;
If R >0;r--
c>r;c
case
k<r;k++
b;
STOP
SOURCE CODE:
#include "iostream"
#include "stdio.h"
#include <cstdlib>
int main()
char choice;
m:
switch(choice)
system("pause");
system("CLS");
goto m;
break;
case 'b' :
//second
for(int k=0;k<r;k++)
cout<<"*";
system("pause");
system("CLS");
goto m;
break;
return 0;
}
OUTPUT:
Plate No. 3
FLOWCHART: START
Declare variables;
A Main Menu
Switch (choice);
Decreasing Increasing
results results
A
SOURCE CODE:
#include<iostream>
int main()
{
int range;
char choice;
m:
cout<< "************ Main Menu ************"<<endl;
cout<< "\n\n A. Increasing"<<endl;
cout<< "\n\n B. Decreasing"<<endl;
cout<< "\n\n C. Exit"<<endl;
cout<< "***********************************"<<endl;
cout<< "Select a choice:";
cin>>choice;
system("cls");
switch(choice)
{
case 'A':
break;
case 'a':
cout<<"\n\n Increasing"<<endl;
cout<<"\n Enter desired number:";
cin>>range;
cout<<endl;
case 'B':
break;
case 'b':
cout<<"\n\n Decreasing"<<endl;
cout<<"\n Enter desired number:";
cin>>range;
case 'C':
break;
case 'c':
break;
}
return 0;
}
OUTPUT:
Plate No 4.
FLOWCHART: START
Declare
functions;
If Initialize
input= timeInfo;
M Read declared
functions;
read time
convention;
Initialize
timeInfo; Set console
display;
Read time
convention;
Time =PM If
hrs
>=12
Display localtime(12
Time =AM hr)
For t=0;t<11;t++
Display localtime(24
hr)
END
SOURCE CODE:
#include <ctime>
#include <conio.h>
#include <iostream>
#include <string>
#include <functional>
#include <windows.h>
COORD CursorPosition;
void Draw(int style, int col, int row, int length,int amount, bool fill, int sw );
string AM_PM;
string Segment[11][10]={ {" \x11\xDB\xDB\xDB\x10 "," "," \x11\xDB\xDB\xDB\x10 "," \x11\xDB\xDB\xDB\x10 "," ","
\x11\xDB\xDB\xDB\x10 "," \x11\xDB\xDB\xDB\x10 "," \x11\xDB\xDB\xDB\x10 "," \x11\xDB\xDB\xDB\x10 ","
\x11\xDB\xDB\xDB\x10 "}, {"\x1E \x1E"," \x1E"," \x1E"," \x1E","\x1E \x1E","\x1E ","\x1E "," \x1E","\x1E \x1E","\x1E
\x1E"}, {"\xDB \xDB"," \xDB"," \xDB"," \xDB","\xDB \xDB","\xDB ","\xDB "," \xDB","\xDB \xDB","\xDB \xDB"}, {"\xDB
\xDB"," \xDB"," \xDB"," \xDB","\xDB \xDB","\xDB ","\xDB "," \xDB","\xDB \xDB","\xDB \xDB"}, {"\x1F \x1F"," \x1F","
\x1F"," \x1F","\x1F \x1F","\x1F ","\x1F "," \x1F","\x1F \x1F","\x1F \x1F"}, {" "," ", " \x11\xDB\xDB\xDB\x10 ","
\x11\xDB\xDB\xDB\x10 "," \x11\xDB\xDB\xDB\x10 "," \x11\xDB\xDB\xDB\x10 "," \x11\xDB\xDB\xDB\x10 "," ","
\x11\xDB\xDB\xDB\x10 "," \x11\xDB\xDB\xDB\x10 "}, {"\x1E \x1E"," \x1E","\x1E "," \x1E"," \x1E"," \x1E","\x1E
\x1E"," \x1E","\x1E \x1E"," \x1E"}, {"\xDB \xDB"," \xDB","\xDB "," \xDB"," \xDB"," \xDB","\xDB \xDB"," \xDB","\xDB
\xDB"," \xDB"}, {"\xDB \xDB"," \xDB","\xDB "," \xDB"," \xDB"," \xDB","\xDB \xDB"," \xDB","\xDB \xDB"," \xDB"},
{"\x1F \x1F"," \x1F","\x1F "," \x1F"," \x1F"," \x1F","\x1F \x1F"," \x1F","\x1F \x1F"," \x1F"}, {" \x11\xDB\xDB\xDB\x10
"," "," \x11\xDB\xDB\xDB\x10 "," \x11\xDB\xDB\xDB\x10 "," "," \x11\xDB\xDB\xDB\x10 "," \x11\xDB\xDB\xDB\x10
"," "," \x11\xDB\xDB\xDB\x10 "," \x11\xDB\xDB\xDB\x10 "} };
string Colon[11] = {" "," "," "," \xFE "," "," "," "," \xFE "," "," "," "};
Draw(2,2,5,76,15,0,2);
gotoXY(73,8,"HR");
do { time_t rawtime;
time ( &rawtime );
ch = toupper(ch); if (ch == 'M') { Military_Time = !Military_Time; ch = ' '; } } if( Military_Time) { AM_PM = " ";
gotoXY(73,7,"24"); } else { AM_PM = "AM"; gotoXY(73,7,"12"); if ( hours >= 12) AM_PM = "PM"; if ( hours == 0 )
hours = 12;
cout << Segment[t][hours/10] << " " << Segment[t][hours%10] << Colon[t] << Segment[t][minutes/10] << " " <<
Segment[t][minutes%10] << Colon[t] << Segment[t][seconds/10] << " " << Segment[t][seconds%10]; }
gotoXY(73,17, AM_PM); Sleep(1000); } while (true); }
void Draw(int style, int col, int row, int length,int amount, bool fill, int sw ) { // Draws a 1 or 2 line box int a; if ( sw
>4) sw = 4; style=(style-1)*6; char box[24]; char shdw[5]; box[0] = '\xDA'; box[1] = '\xBF'; box[2] = '\xC0'; box[3] =
'\xD9'; box[4] = '\xB3'; box[5] = '\xC4'; box[6] = '\xC9'; box[7] = '\xBB'; box[8] = '\xC8'; box[9] = '\xBC'; box[10] =
'\xBA'; box[11] = '\xCD'; box[12] = '\xD5';// + box[13] = '\xB8';// + box[14] = '\xD4';// + box[15] = '\xBE';// + box[16] =
'\xB3';// box[17] = '\xCD';// - box[18] = '\xD6';// + box[19] = '\xB7';// + box[20] = '\xD3';// + box[21] = '\xBD';// +
box[22] = '\xBA';// box[23] = '\xC4';// - shdw[1] = '\xB0';// shdw[2] = '\xB1';// shdw[3] = '\xB2';// shdw[4] =
'\xDB';// char tl,tr,bl,br,side,edge,shadow; tl = box[style]; tr = box[style+1]; bl = box[style+2]; br = box[style+3];
side = box[style+4]; edge = box[style+5]; shadow = shdw[sw]; string Line(length-2,edge); string
Shadow(length,shadow); string Fill(length-2, ' '); gotoXY(col,row);
cout << tl << Line << tr; for (a = 1; a <amount-1;a++) { gotoXY(col,row+a); cout << side; if (fill) cout << Fill; else
gotoXY(col+length-1,row+a); cout << side; if (sw) cout << shadow; } gotoXY(col,(amount+row)-1);
cout << bl << Line << br; if (sw) { cout << shadow; gotoXY(col+1,row+amount , Shadow ); } } void gotoXY(int x,
int y) { CursorPosition.X = x; CursorPosition.Y = y; SetConsoleCursorPosition(console,CursorPosition); } void
gotoXY(int x, int y, string text) { CursorPosition.X = x; CursorPosition.Y = y;