forked from pezy/CppPrimer
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
10 changed files
with
122 additions
and
132 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
int main() | ||
{ | ||
return 0; | ||
return 0; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,11 @@ | ||
#include <iostream> | ||
#include "include/Sales_item.h" | ||
#include "../include/Sales_item.h" | ||
|
||
int main() | ||
{ | ||
Sales_item item; | ||
while (std::cin >> item) | ||
std::cout << item << std::endl; | ||
Sales_item item; | ||
while (std::cin >> item) | ||
std::cout << item << std::endl; | ||
|
||
return 0; | ||
return 0; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,18 +1,16 @@ | ||
#include <iostream> | ||
#include "include/Sales_item.h" | ||
#include "../include/Sales_item.h" | ||
|
||
int main() | ||
{ | ||
Sales_item item1, item2; | ||
std::cin >> item1 >> item2; | ||
if (item1.isbn() == item2.isbn()) | ||
{ | ||
std::cout << item1 + item2 << std::endl; | ||
return 0; | ||
} | ||
else | ||
{ | ||
std::cerr << "Data must refer to same ISBN." << std::endl; | ||
return -1; | ||
} | ||
Sales_item item1, item2; | ||
std::cin >> item1 >> item2; | ||
if (item1.isbn() == item2.isbn()) { | ||
std::cout << item1 + item2 << std::endl; | ||
return 0; | ||
} | ||
else { | ||
std::cerr << "Data must refer to same ISBN." << std::endl; | ||
return -1; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
#include <iostream> | ||
#include "include/Sales_item.h" | ||
#include "../include/Sales_item.h" | ||
|
||
int main() | ||
{ | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,28 +1,24 @@ | ||
#include <iostream> | ||
#include "include/Sales_item.h" | ||
#include "../include/Sales_item.h" | ||
|
||
int main() | ||
{ | ||
Sales_item currItem, valItem; | ||
if (std::cin >> currItem) | ||
{ | ||
int cnt = 1; | ||
while (std::cin >> valItem) | ||
{ | ||
if (valItem.isbn() == currItem.isbn()) | ||
++cnt; | ||
else | ||
{ | ||
Sales_item currItem, valItem; | ||
if (std::cin >> currItem) { | ||
int cnt = 1; | ||
while (std::cin >> valItem) { | ||
if (valItem.isbn() == currItem.isbn()) | ||
++cnt; | ||
else { | ||
std::cout << currItem << " occurs " | ||
<< cnt << " times " << std::endl; | ||
currItem = valItem; | ||
cnt = 1; | ||
} | ||
} | ||
|
||
std::cout << currItem << " occurs " | ||
<< cnt << " times " << std::endl; | ||
currItem = valItem; | ||
cnt = 1; | ||
} | ||
<< cnt << " times " << std::endl; | ||
} | ||
|
||
std::cout << currItem << " occurs " | ||
<< cnt << " times " << std::endl; | ||
} | ||
return 0; | ||
return 0; | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters