0
// War Game made by Jeremy Wayman
 
#include <iostream>
#include <cstdlib>
#include <ctime>
#include <fstream>
#include <string>
 
using namespace std;

int cardValue[13] = {1,2,3,4,5,6,7,8,9,10,11,12,13}; // Declaring first array
string cardType[4]; // Declaring second array
ifstream inFile; // Declaring a reading inFile
void displayRules(); // Declaring function displayRules
bool winner(int card1[], string type1[], int card2[], string type2[]); // Declaring function winner
void initialize();


int main()

{
	
	
	
	return 0;
};

bool winner(int card1[], string type1[], int card2[], string type2[]);
{


}

void displayRules()
{
	cout << "Welcome to the game of war!"
	     << "Your cards will be selected at random from \n "
	     << "a normal deck of cards. The symbols will \n "
	     << "be ranked in order of Hearts, Spades, Diamonds, "
	     << "and Clubs. You will be playing against a computer "
         << "opponent. ";
}

int cardValue();
{
	inFile.open("cards.txt");
	
	for(int i =0; i < 4; i++)
	cardType[i] = inFile.get();      //not sure about this inFile function
	
}

	
string convertCard(cardValue val[], cardType type[]);
{
	string temp;

	if (val[] == 11)
	return "jack";
	else if(val[] == 12)
	return "queen";
	else if(val[] == 13)
	return "king";
	else
	return val[];
}

So I am trying to make a war game. First of all I want to read in from a text file, I am reading in the values for an array. I need to use 2 arrays and I need input/output. I am trying to create a game of war that randomly picks cards for both players and then based on what you get is if you win or not.

2
Contributors
7
Replies
8
Views
9 Years
Discussion Span
Last Post by Ancient Dragon
0

Is that all there is to the file? What good does it do to list the four types of cards in the file without the quantity that the user holds.

0

Yea but the whole point is that I want to practice reading in from a text file cuz i am unclear on how to do it

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.