Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 4

Adding Text Color in C++

-to add text color, use the COLOR DOS command.


Syntax:
system(“COLOR bf”);

Clearing the screen


-To clear the screen, use the CLS command.
Syntax:
system(“CLS”);

Example:
1. Make a program that will asks the employees number of hours worked and rate per hour and display
his salary.
#include <iostream>
using namespace std;
int main()
{
system("COLOR 0a");
int intHour, intRate, intSalary;
cout<<"Hours worked:"<<endl;
cin>>intHour;
system("CLS");
cout<<"Rate per hour:"<<endl;
cin>>intRate;
system("CLS");
intSalary=intHour * intRate;
cout<<"Salary:"<<intSalary<<endl;
system("pause");
return 0;
}
2. Make a program that will ask the original price of the shirt, display the 25% discount, and the new
price.
#include <iostream>
using namespace std;
int main()
{
system("COLOR 0a");
float fltPrice, fltDiscount, fltNewprice;
cout<<"Original price:"<<endl;
cin>>fltPrice;
fltDiscount=fltPrice *.25;
cout<<"Discount:"<<fltDiscount<<endl;
fltNewprice=fltPrice-fltDiscount;
cout<<"New price:"<<fltNewprice<<endl;
system("pause");
return 0;
}Activity:
1. Develop a program that will ask the number of kilometers travelled, the fare per kilometer and display
the total fare.
2. Make a program that will ask the charge per minute of phone call, the number of minutes used ,the
subtotal, the tax @5%, and the total bill.
3. Write a program that will ask the price per shirt, the number of shirt ordered, and display the total
cost.
Pseudocode
-“Pseudo” means imitation or false and “code” refers to the instructions written in a programming
language.
-a notation resembling resembling a simplified language.
-also called Program Design Language.

Pseudocode is made up of the following logic:


1. Sequence
2. Selection
3. Iteration

Rules in Writing Pseudocode


1. Write only one statement per line.
-each statement in your Pseudocode should express just one action for the computer.
2. Capitalized initial keyword for inputs and outputs.
-use READ, GET, INPUT for inputs.
-use SHOW, DISPLAY, OUTPUT for outputs.
3. Indent to show hierarchy.
-Sequence all starting in the same column.
-Indent statements that fall inside the selection structure.
-Indent statement with looping structure.
4. Keep statement language independent.

Standard for a Good Pseudocode


1. Number each instruction.
2. Each instruction should be unambiguous.
3. Completeness.

Nesting tags
-To nest tags, use the first in-last out rule.

HTML Text Formatting Tags


1. Bold Tag
-creates a bold text.
Syntax:
<b>Your text</b>
Another tag used to bold text is <strong>.
Syntax:
<strong>Your text</strong>
2. Italic Tag
-creates italic text.
Syntax:
<i>Your text</i>
Another tag used to italicize text is <em>.
Syntax:
<em>Your Text</em>

You might also like