So i'm not looking for anyone to give me code on how to do this.
I would just like a tip or two.

I have a .txt file with a deck of cards in it saved into a card struct like :

struct card 
    char suit;             
    char value;             

now i want to search for Joker A and B each have a suit of either 'A' or 'B'

with joker A i wanna move it down 1 spot in the array and if its already at the bottom of the array i wanna move it 2 down and the same thing with B joker except i want to move it 2 down and if its going to end up on top of the deck i wanna move it 3 down.

I know how to do most of it besides the part of moving the array values w/o erasing them in the process.

I've seen people using memmove but I have no clue how to use it and being that this is an assignment I don't really feel like learning something I'm not supposed to use any way.

Sorry if its confusing lol

If you know how to do most of it, how about doing the part you know how to do, posting the code, and asking for advice on how to do the rest?

for (int i = 0; i < NUMCARDS-1; i++)
		if (key[i].suit == 'A') 
			key[i].suit = temp [i+1].suit;
			key[i].value = temp[i+1].value ;	
 	for (int i = 0; i < NUMCARDS-1; i++)
		temp[i].suit = key[i].suit;
		temp[i].value = key[i].value;

is what i have so far but obviously that won't work once it get's to the last card. Output is essentially the same thing except the does something funny to the jokers suit and value

From what I've figured out I'm just trying to move it to a temp array then after the work is done move it back into the main key array.

Edit: Rephrase on what i said. I know what i want to accomplish I just cant for the life of me figure out how to get there :/

Edited 5 Years Ago by Armistice: n/a

This article has been dead for over six months. Start a new discussion instead.