- Mar 31, 2003
- 11,679
- 0
- 81
Right now I have my main (Menu) function which then calls a function entitled "Card_Array". Card Array generates 3 integers (i, j, k) via random number generators. I then WANT these 3 variables to go from "Card_Array" into "Card Assignments". I keep getting identifier not found when trying to call the "Card_Assignments()" within "Card_Array". Here is a brief part of my code:
//These 2 lines are in the main function. Later in the function I type Card_Array()
void Card_Assignments(int &i,int &j,int &k);
void Card_Array();
void Card_Array()
{
cout << "\n---------------------------------------------";
cout << "\n\nWelcome to 'War'\n\n";
srand((unsigned)time(0));
int i = rand()%(b-a+1) + a;
int j = rand()%(c-a+1) + a;
int k = rand()%(d-b+1) + b;
Card_Assignments(i, j, k);
}
void Card_Assignments(int &i,int &j,int &k)
{
if ((count%2)==0)
if(i==1)
{
...
}
What do I have to do to get all of these values moving around without using global variables.
I have managed to solve this problem, with you guys help. Now however, I am stuck once again. I'll optimize my coding later.
I am stuck on reading the first letter of the every word from a file. I have tried to manipulate the stringVar.find() command but I can't get it to work. I have a txt file that I made up that when you grab the first letter of every word, I then store it to a character array. When completed the array of characters will spell out another word.
Right now I can't figure out how to find the index of the first character-- can someone just give me some general help?
-Kevin
