// you’re reading...

Variable and Data Types

Practical Learning: Using Short Integer Variables

1. Start your programming environment and create a new project named ABCCS1.
Depending on your environment, if the file was not created already, then create a source file and save it as, or name it exercise.cpp


2. Set the file’s content as follows (A-1):


Example of (A-1)

#include <iostream>
 
using namespace std;
 
int main()
 
{
 
	unsigned short shirts;
 
	unsigned short pants;
 
	unsigned short dresses;
 
	unsigned short ties;
 
 
 
	cout << " -=- ABC Cleaning Services -=-\n";
 
	cout << "Enter number of shirts: ";
 
	cin >> shirts;
 
	cout << "Enter number of pants: ";
 
	cin >> pants;
 
	cout << "Enter number of dresses: ";
 
	cin >> dresses;
 
	cout << "Enter number of ties: ";
 
	cin >> ties;
 
 
 
	cout << "\n====================================";
 
	cout << "\n-=- ABC Cleaning Services -=-";
 
	cout << "\n====================================";
 
	cout << "\nCustomer Order"
 
	        << "\nItem Type  Qty"
 
	        << "\nShirts:     " << shirts
 
	        << "\nPants:      " << pants
 
	        << "\nDresses:    " << dresses
 
	        << "\nTies:       " << ties
 
	        << "\n\n";
 
 
 
	return 0;
 
}



3. Execute the application and perform the exercise. Here is an example (A-2):


Example of (A-2)

-=- ABC Cleaning Services -=-
Enter number of shirts: 6
Enter number of pants: 2
Enter number of dresses: 3
Enter number of ties: 4

====================================
-=- ABC Cleaning Services -=-
====================================
Customer Order
Item Type  Qty
Shirts:     6
Pants:      2
Dresses:    3
Ties:       4



4. Return to your programming environment

Discussion

No comments for “Practical Learning: Using Short Integer Variables”

Post a comment