update,
This commit is contained in:
BIN
task1/_ref/C++ Project.pdf
Normal file
BIN
task1/_ref/C++ Project.pdf
Normal file
Binary file not shown.
BIN
task1/_ref/Chapter01/Chapter 01.pdf
Normal file
BIN
task1/_ref/Chapter01/Chapter 01.pdf
Normal file
Binary file not shown.
BIN
task1/_ref/Chapter02/Chapter 02.pdf
Normal file
BIN
task1/_ref/Chapter02/Chapter 02.pdf
Normal file
Binary file not shown.
19
task1/_ref/Chapter02/helloworld.cpp
Normal file
19
task1/_ref/Chapter02/helloworld.cpp
Normal file
@@ -0,0 +1,19 @@
|
||||
#include <iostream>
|
||||
#include <iomanip>
|
||||
|
||||
using namespace std;
|
||||
|
||||
int main()
|
||||
{
|
||||
std::cout << "Price list of a restaurant"<<endl;
|
||||
std::cout << setw(20)
|
||||
<< setfill(' ')
|
||||
<< left
|
||||
<< "Cheese burger: "
|
||||
<< " $"
|
||||
<< setw(4)
|
||||
<< setfill(' ')
|
||||
<< right
|
||||
<< "14"
|
||||
<< endl;
|
||||
}
|
BIN
task1/_ref/Chapter03/Chapter 03.pdf
Normal file
BIN
task1/_ref/Chapter03/Chapter 03.pdf
Normal file
Binary file not shown.
45
task1/_ref/Chapter03/helloworld.cpp
Normal file
45
task1/_ref/Chapter03/helloworld.cpp
Normal file
@@ -0,0 +1,45 @@
|
||||
#include <iostream>
|
||||
#include <fstream>
|
||||
#include <iomanip>
|
||||
#include <string>
|
||||
|
||||
using namespace std;
|
||||
|
||||
int main(){
|
||||
//Declare variables
|
||||
ifstream inFile;
|
||||
ofstream outFile;
|
||||
string burger_name, fries_name, icecream_name;
|
||||
int burger_price, fries_price, icecream_price;
|
||||
//Open the input file and output file
|
||||
inFile.open("price.txt");
|
||||
|
||||
if (!inFile) {
|
||||
cout << "Cannot open the input file."
|
||||
<< "The program terminates." << endl;
|
||||
return 1;
|
||||
}
|
||||
|
||||
outFile.open("price_output.out");
|
||||
cout << "Processing data" << endl;
|
||||
|
||||
//Read file word by word
|
||||
inFile >> burger_name >> burger_price;
|
||||
inFile >> fries_name >> fries_price;
|
||||
inFile >> icecream_name >> icecream_price;
|
||||
|
||||
//Output file
|
||||
outFile << "The price of " << burger_name
|
||||
<< " is $" << burger_price <<"." << endl;
|
||||
|
||||
outFile << "The price of " << fries_name
|
||||
<< " is $" << fries_price << "." << endl;
|
||||
|
||||
outFile << "The price of " << icecream_name
|
||||
<< " is $" << icecream_price << "." << endl;
|
||||
inFile.close(); // .close(): close a file
|
||||
outFile.close();
|
||||
cout << "Processing completed" << endl;
|
||||
|
||||
return 0;
|
||||
}
|
3
task1/_ref/Chapter03/price.txt
Normal file
3
task1/_ref/Chapter03/price.txt
Normal file
@@ -0,0 +1,3 @@
|
||||
burger 15
|
||||
fries 11
|
||||
ice-cream 9
|
BIN
task1/_ref/Chapter04/Chapter 04.pdf
Normal file
BIN
task1/_ref/Chapter04/Chapter 04.pdf
Normal file
Binary file not shown.
0
task1/_ref/Chapter04/helloworld.cpp
Normal file
0
task1/_ref/Chapter04/helloworld.cpp
Normal file
BIN
task1/_ref/Chapter05/Chapter 05.pdf
Normal file
BIN
task1/_ref/Chapter05/Chapter 05.pdf
Normal file
Binary file not shown.
BIN
task1/_ref/Chapter06/Chapter 06.pdf
Normal file
BIN
task1/_ref/Chapter06/Chapter 06.pdf
Normal file
Binary file not shown.
BIN
task1/_ref/Chapter07/Chapter 07.pdf
Normal file
BIN
task1/_ref/Chapter07/Chapter 07.pdf
Normal file
Binary file not shown.
BIN
task1/_ref/Chapter08/Chapter 08.pdf
Normal file
BIN
task1/_ref/Chapter08/Chapter 08.pdf
Normal file
Binary file not shown.
BIN
task1/_ref/Chapter09/Chapter 09.pdf
Normal file
BIN
task1/_ref/Chapter09/Chapter 09.pdf
Normal file
Binary file not shown.
BIN
task1/_ref/Chapter10/Chapter 10.pdf
Normal file
BIN
task1/_ref/Chapter10/Chapter 10.pdf
Normal file
Binary file not shown.
Reference in New Issue
Block a user