Advertisement
Guest User

Untitled

a guest
Nov 17th, 2019
199
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.52 KB | None | 0 0
  1. //"I pledge my honor that I have abided by the Stevens Honor System" - ajmauceri
  2.  
  3. //declaring libraries
  4. #include <iostream>
  5. #include <string>
  6. #include <cmath>
  7. #include <math.h>
  8. #include <map>
  9. #include <algorithm>
  10. #include <chrono>
  11. #include <ctime>
  12. #include <time.h>
  13. #include <stdio.h>
  14. #include <iomanip>
  15. #include "Bank.h"
  16. #include <string.h>
  17. #include <string>
  18. #include <fstream>
  19.  
  20. //declaring namespace
  21. using namespace std;
  22. using namespace bank;
  23.  
  24. //returns lowercase values of typed functions
  25. string stringToLower(string input)
  26. {
  27. transform(input.begin(), input.end(), input.begin(), tolower);
  28. return input;
  29. }
  30.  
  31. //Using "an" or "a" in a sentence
  32. string aOrAn(string nextWord) {
  33. nextWord = stringToLower(nextWord);
  34. char firstChar = nextWord.at(0);
  35. if (firstChar == 'a' ||
  36. firstChar == 'e' ||
  37. firstChar == 'i' ||
  38. firstChar == 'o' ||
  39. firstChar == 'u')
  40. {
  41. return "an";
  42. }
  43. else {
  44. return "a";
  45. }
  46. }
  47.  
  48. void SaveData() {
  49. string
  50.  
  51. //1. open a real file on your hard drive
  52. writer.open("BankData.txt", ios::app); //Creates a file titled MyContact.txt and ios::app makes it so it only adds info without deleting previous data
  53.  
  54. //2. Write 'name' and 'phone' onto that file we just opened
  55. writer << name << " " << phone;
  56.  
  57. //3. Save and close that file.
  58. writer.close();
  59. }
  60.  
  61. string LoadData() {
  62. ifstream reader;
  63. string newline;
  64.  
  65. //1. Open a file so you can read from it
  66. reader.open("MyContacts.txt");
  67.  
  68. //2. go ahead and read everything in it
  69. while (getline(reader, newline)) {
  70. cout << newline << endl;
  71. }
  72.  
  73. //3. close the file
  74. reader.close();
  75.  
  76. }
  77.  
  78.  
  79. //Capitalizing the first letter in a sentence
  80. string CapitalizeFirstLetter(string input) {
  81. input[0] = toupper(input[0]);
  82. return input;
  83. }
  84.  
  85. //setting the color of a sentence
  86. void PrintMessageInColor(string message, int color) {
  87. cout << "\033[1;" << color << "m" << message << "\033[0m";
  88. }
  89.  
  90. //standard color for Error Messages
  91. void PrintError(string message)
  92. {
  93. PrintMessageInColor(message, 31);
  94. }
  95.  
  96. //setting a class for a transaction
  97. class Transaction
  98. {
  99. public:
  100. string name = "Transaction";
  101. float value = 0;
  102.  
  103.  
  104.  
  105. Transaction(string transactionName, float initialValue) {
  106. name = transactionName;
  107. value = initialValue;
  108. }
  109.  
  110. string ToString() {
  111. return name + " " + std::to_string(value) + "\r\n";
  112. }
  113.  
  114. };
  115.  
  116.  
  117. //teaching the compiler what a bank account is
  118. class BankAccount
  119. {
  120.  
  121. };
  122.  
  123.  
  124. int main()
  125. {
  126. for (; ; ) {
  127. auto now = std::chrono::system_clock::now();
  128. cout << now;
  129.  
  130. }
  131.  
  132. return 1;
  133. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement