Code:
#include <iostream>
002
#include <process.h>
003
#include <iomanip>
004
#include <conio.h>
005
#include <string>
006
#include <stdio.h>
007
#include <ctype.h>
008
#include <windows.h>
009
using namespace std;
010
011
void gotoxy(int x, int y)
012
{
013
COORD coord;
014
coord.X = x;
015
coord.Y = y;
016
SetConsoleCursorPosition(GetStdHandle(STD_OUTPUT_HANDLE), coord);
017
}
018
019
void clrscr(int x, int y)
020
{
021
COORD coordScreen = { x, y };
022
DWORD cCharsWritten;
023
CONSOLE_SCREEN_BUFFER_INFO csbi;
024
DWORD dwConSize;
025
HANDLE hConsole = GetStdHandle(STD_OUTPUT_HANDLE);
026
GetConsoleScreenBufferInfo(hConsole, &csbi);
027
dwConSize = csbi.dwSize.X * csbi.dwSize.Y;
028
FillConsoleOutputCharacter(hConsole, TEXT(' '),
029
dwConSize, coordScreen, &cCharsWritten);
030
GetConsoleScreenBufferInfo(hConsole, &csbi);
031
FillConsoleOutputAttribute(hConsole, csbi.wAttributes,
032
dwConSize, coordScreen, &cCharsWritten);
033
SetConsoleCursorPosition(hConsole, coordScreen);
034
}
035
036
void main (void)
037
{
038
int isbn[5] = {11110, 12221, 13332, 24443, 25554};
039
string book_title[5] = {"Binary Kibbles and Bits", "Syntaxico", "Vitamin C++", "Surf and Turf the Web",
040
"Java-lin: Olympic Favorite"};
041
float retail[5] = {155.95, 116.75, 126.50, 125.75, 138.99};
042
int i = 0;
043
int x = 6;
044
int qty = 0;
045
int y = 0;
046
float total = 0.00;
047
string option = "t";
048
049
050
051
gotoxy(10,4);
052
cout << "ISBN" << endl;
053
054
gotoxy(20,4);
055
cout << "Title" << endl;
056
057
gotoxy(47,4);
058
cout << "Price" << endl;
059
060
gotoxy(54,4);
061
cout << "Qty" << endl;
062
063
gotoxy(58,4);
064
cout << "Total" << endl;
065
066
do
067
{
068
069
gotoxy(10,x);
070
cin >> i;
071
072
for(y = 0; y < 5; y++)
073
{
074
if(i == isbn[y])
075
break;
076
else if(i !=
077
{
078
gotoxy(10,x);
079
cin >> i;
080
}
081
}
082
083
for(y = 0; y < 5; y++)
084
{
085
if(i == isbn[y])
086
break;
087
}
088
089
090
gotoxy(20,x);
091
cout << book_title[y] << endl;
092
093
gotoxy(47,x);
094
cout << retail[y] << endl;
095
096
gotoxy(54,x);
097
cin >> qty;
098
099
total = retail[y]* qty;
100
101
gotoxy(58,x);
102
cout << total << endl;
103
104
x++;
105
106
gotoxy(10,11);
107
cout << "Press t for total, or type in another ISBN number." << endl;
108
gotoxy(10,x);
109
cin >> option;
110
gotoxy(10,11);
111
clrscr(10,11);
112
if(option == "t");
113
break;
114
115
}while(option == "t" || x < 11);
116
117
118
_getch();
119
120
}