Advertisement
payjack

all intmain

Dec 12th, 2017
95
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.94 KB | None | 0 0
  1. //ACSL
  2. //Olivia Pagach
  3. //12-11-17
  4.  
  5. //stuff
  6. #include <iostream>
  7. #include <time.h>
  8. #include <stdlib.h>
  9. #include <iomanip>
  10. #include <fstream>
  11.  
  12. using namespace std;
  13.  
  14. //main thing
  15. int main ()
  16. {
  17. cout<<"| ACSL CARD GAME | "<<endl;
  18. cout<<"Olivia Pagach | Kubik 2A"<<endl;
  19.  
  20. int i=0;
  21. int start=0;
  22. char comma = ',';
  23.  
  24. ifstream infile;
  25.  
  26. char cNum [11];
  27. int playerthree [3];
  28. int cards [8];
  29.  
  30. ofstream outFile;
  31.  
  32. infile.open ("cards.txt", ifstream::in);
  33. if (infile.is_open())
  34. {
  35. while (infile.good())
  36. {
  37. infile.getline(cNum, 256, ',');
  38. if (i==0)
  39. {
  40. start=atoi(cNum);
  41. cout<<start;
  42. }
  43. if (i==1 && 2 && 3)
  44. {
  45. playerthree[i]=atoi(cNum);
  46. cout<<playerthree [1]<<endl;
  47. cout<<playerthree [2]<<endl;
  48. cout<<playerthree [3]<<endl;
  49.  
  50. }
  51. else {
  52. cards[i] = atoi(cNum);
  53. cout<<cards [i];
  54. i++;
  55. }
  56. i++;
  57.  
  58. }
  59. infile.close();
  60. }
  61. else
  62. {
  63. cout<<"Error opening file"<<endl;
  64.  
  65. }
  66. int total=start;
  67. for (int i=1; i<11; i++)
  68. {
  69. total=total+playerthree[1];
  70. if (total>=99)
  71. {
  72. cout<<"**GAME OVER** Dealer wins. FINAL SCORE:"<<total<<endl;
  73. }else
  74. {
  75. total=total+cards[5];
  76. if (total>=99)
  77. {
  78. cout<<"**GAME OVER** Player wins. FINAL SCORE:"<<total<<endl;
  79. }else
  80. {
  81. total=total+playerthree[2];
  82. if (total>=99)
  83. {
  84. cout<<"**GAME OVER** DEALER wins. FINAL SCORE:"<<total<<endl;
  85. }else
  86. {
  87. total=total+cards[7];
  88. if (total>=99)
  89. {
  90. cout<<"**GAME OVER** PLAYER wins. FINAL SCORE:"<<total<<endl;
  91. }else
  92. {
  93. total=total+playerthree [3];
  94. if (total>=99)
  95. {
  96. cout<<"**GAME OVER** DEALER WINS. FINAL SCORE:"<<total<<endl;
  97. }else{
  98. total=total+cards [9];
  99. if (total>=99)
  100. {
  101. cout<<"**GAME OVER** PLAYER wins. FINAL SCORE:"<<total<<endl;
  102. }else{
  103. total=total+cards[4];
  104. if (total>=99)
  105. {
  106. cout<<"**GAME OVER** DEALER wins. FINAL SCORE:"<<total<<endl;
  107. }else{
  108. cout<<"This program is at capacity. The dealer has no cards left so the Player is winner by default."<<endl;
  109. cout<<"Thank you, please give me a good grade lol."<<endl;
  110. }
  111. }
  112. }
  113. }
  114. }
  115. }
  116. }
  117. }
  118. return 0;
  119. }
  120.  
  121.  
  122.  
  123. ikddd
  124. int total=start;
  125. for (int i=1; i<11; i++)
  126. {
  127. total=total+playerthree[1];
  128. if (total>=99)
  129. {
  130. cout<<"**GAME OVER** Dealer wins. FINAL SCORE:"<<total<<endl;
  131. }else
  132. {
  133. total=total+cards[5];
  134. if (total>=99)
  135. {
  136. cout<<"**GAME OVER** Player wins. FINAL SCORE:"<<total<<endl;
  137. }else
  138. {
  139. total=total+playerthree[2];
  140. if (total>=99)
  141. {
  142. cout<<"**GAME OVER** DEALER wins. FINAL SCORE:"<<total<<endl;
  143. }else
  144. {
  145. total=total+cards[7];
  146. if (total>=99)
  147. {
  148. cout<<"**GAME OVER** PLAYER wins. FINAL SCORE:"<<total<<endl;
  149. }else
  150. {
  151. total=total+playerthree [3];
  152. if (total>=99)
  153. {
  154. cout<<"**GAME OVER** DEALER WINS. FINAL SCORE:"<<total<<endl;
  155. }else{
  156. total=total+cards [9];
  157. if (total>=99)
  158. {
  159. cout<<"**GAME OVER** PLAYER wins. FINAL SCORE:"<<total<<endl;
  160. }else{
  161. total=total+cards[4];
  162. if (total>=99)
  163. {
  164. cout<<"**GAME OVER** DEALER wins. FINAL SCORE:"<<total<<endl;
  165. }else{
  166. cout<<"This program is at capacity. The dealer has no cards left so the Player is winner by default."<<endl;
  167. cout<<"Thank you, please give me a good grade lol."<<endl;
  168. }
  169. }
  170. }
  171. }
  172. }
  173. }
  174. }
  175. }
  176. return 0;
  177. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement