Displaying a cue and square of a number through functions in C++

Essay by syedraza70 April 2004

download word file, 1 pages 5.0

/***********************************************************************

* file: 3-14.cpp *

* desc: C++ assignment *

* Author: Syed R Fayyaz *

* Date: September 26, 2003 *

* *

* Comment: Homework assignment # 7 *

**********************************************************************/

//Assigning header files that will be used in this program.

#include

#include

#include

//Program began

int main()

{

//variable decleration section

intnw_pcqty,

mem_cardqty,

dsk_driveqty,

softqty;

double total,

nw_pc,

mem_card,

dsk_drive,

soft;

//constant section

const double NW_PCPRICE = 675.00,

MEM_CARDPRICE = 69.95,

DSK_DRIVEPRICE = 198.50,

SOFTPRICE = 34.98;

//Input section

cout << "\t" << "**************************************"

<< "\n";

cout << "\t\t" << "New Wave Computer "

<< "\n\n";

cout << "Please enter the quantities of folwoing Items"

<< "\n\n";

cout << "Amount of NW-PCs needed ";

cin >> nw_pcqty;

cout << "Amount of memory cards needed ";

cin >> mem_cardqty;

cout << "Amount of Disk drives needed ";

cin >> dsk_driveqty;

cout << "Amount of softwares needed ";

cin >> softqty;

//input closing section

cout << "\n\n" << "\t\t"

<< "*****************" << "\n";

cout << "Thank you for shopping" << "\n"

<< "Your sale reciept will be ready in a moment" << "\n";

cout << "Please press any key to continue";

getch();

//calculation section

//NW-PC calculation

nw_pc = nw_pcqty * NW_PCPRICE ;

//Memory Card calculation

mem_card = mem_cardqty * MEM_CARDPRICE;

//Disk drive calculation

dsk_drive = dsk_driveqty * DSK_DRIVEPRICE;

//Software calculation

soft = softqty * SOFTPRICE;

//getting total

total = nw_pc + mem_card +dsk_drive + soft;

// Setting the flags

cout << setiosflags ( ios::fixed | ios::showpoint | ios::right )

<< setprecision(2);

//output section

clrscr();

cout << "\t"

<< "*********************************"

<< "\n";

cout << "\t\t" << "New Wave Computers"

<< "\n\n";

cout << "Qty" << "\t" << " ITEM" << "\t\t\t"

<< "COST" << "\n\n";

cout << nw_pcqty << "\t" << "NW-PC"

<< "\t\t\t" << "$"

<< setw(7) <<...