Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //ACSL
- //Olivia Pagach
- //12-11-17
- //stuff
- #include <iostream>
- #include <time.h>
- #include <stdlib.h>
- #include <iomanip>
- #include <fstream>
- using namespace std;
- //main thing
- int main ()
- {
- cout<<"| ACSL CARD GAME | "<<endl;
- cout<<"Olivia Pagach | Kubik 2A"<<endl;
- int i=0;
- int start=0;
- char comma = ',';
- ifstream infile;
- char cNum [11];
- int playerthree [3];
- int cards [8];
- ofstream outFile;
- infile.open ("cards.txt", ifstream::in);
- if (infile.is_open())
- {
- while (infile.good())
- {
- infile.getline(cNum, 256, ',');
- if (i==0)
- {
- start=atoi(cNum);
- cout<<start;
- }
- if (i==1 && 2 && 3)
- {
- playerthree[i]=atoi(cNum);
- cout<<playerthree [1]<<endl;
- cout<<playerthree [2]<<endl;
- cout<<playerthree [3]<<endl;
- }
- else {
- cards[i] = atoi(cNum);
- cout<<cards [i];
- i++;
- }
- i++;
- }
- infile.close();
- }
- else
- {
- cout<<"Error opening file"<<endl;
- }
- int total=start;
- for (int i=1; i<11; i++)
- {
- total=total+playerthree[1];
- if (total>=99)
- {
- cout<<"**GAME OVER** Dealer wins. FINAL SCORE:"<<total<<endl;
- }else
- {
- total=total+cards[5];
- if (total>=99)
- {
- cout<<"**GAME OVER** Player wins. FINAL SCORE:"<<total<<endl;
- }else
- {
- total=total+playerthree[2];
- if (total>=99)
- {
- cout<<"**GAME OVER** DEALER wins. FINAL SCORE:"<<total<<endl;
- }else
- {
- total=total+cards[7];
- if (total>=99)
- {
- cout<<"**GAME OVER** PLAYER wins. FINAL SCORE:"<<total<<endl;
- }else
- {
- total=total+playerthree [3];
- if (total>=99)
- {
- cout<<"**GAME OVER** DEALER WINS. FINAL SCORE:"<<total<<endl;
- }else{
- total=total+cards [9];
- if (total>=99)
- {
- cout<<"**GAME OVER** PLAYER wins. FINAL SCORE:"<<total<<endl;
- }else{
- total=total+cards[4];
- if (total>=99)
- {
- cout<<"**GAME OVER** DEALER wins. FINAL SCORE:"<<total<<endl;
- }else{
- cout<<"This program is at capacity. The dealer has no cards left so the Player is winner by default."<<endl;
- cout<<"Thank you, please give me a good grade lol."<<endl;
- }
- }
- }
- }
- }
- }
- }
- }
- return 0;
- }
- ikddd
- int total=start;
- for (int i=1; i<11; i++)
- {
- total=total+playerthree[1];
- if (total>=99)
- {
- cout<<"**GAME OVER** Dealer wins. FINAL SCORE:"<<total<<endl;
- }else
- {
- total=total+cards[5];
- if (total>=99)
- {
- cout<<"**GAME OVER** Player wins. FINAL SCORE:"<<total<<endl;
- }else
- {
- total=total+playerthree[2];
- if (total>=99)
- {
- cout<<"**GAME OVER** DEALER wins. FINAL SCORE:"<<total<<endl;
- }else
- {
- total=total+cards[7];
- if (total>=99)
- {
- cout<<"**GAME OVER** PLAYER wins. FINAL SCORE:"<<total<<endl;
- }else
- {
- total=total+playerthree [3];
- if (total>=99)
- {
- cout<<"**GAME OVER** DEALER WINS. FINAL SCORE:"<<total<<endl;
- }else{
- total=total+cards [9];
- if (total>=99)
- {
- cout<<"**GAME OVER** PLAYER wins. FINAL SCORE:"<<total<<endl;
- }else{
- total=total+cards[4];
- if (total>=99)
- {
- cout<<"**GAME OVER** DEALER wins. FINAL SCORE:"<<total<<endl;
- }else{
- cout<<"This program is at capacity. The dealer has no cards left so the Player is winner by default."<<endl;
- cout<<"Thank you, please give me a good grade lol."<<endl;
- }
- }
- }
- }
- }
- }
- }
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement