Jump to content

Thank you soooo much , I'll report back soon. You are a blessing

         cout << "Users Guess" << "\t\t\t" << "Generated Cards" << endl;    for (int i = 0; i < 5; ++i) {        // Get the names of the choices from the deck        std::string UserChoice = CARDS;       std::string GeneratedCard = CARDS;        // print the names side by side        cout << UserChoice << "\t\t\t" <<GeneratedCards<< endl;    }          

Am I on the right track?  I am getting a weird error here, I can only input two pointers.

 

Or

std::string UserChoice = GetGuess();       std::string GeneratedCard = GenerateCorrectCards;

Hmm

Link to comment
https://linustechtips.com/topic/266389-function-help-c/page/2/#findComment-3630274
Share on other sites

Link to post
Share on other sites

OOH dear lord I swear i did that and it gave me an error haha is it strange to say I love you lollllll  It did generate nothing like you said and is also only giving me the user input, my brain is so numb from staring at this code for days straight... so should i decrement cards *(deck + i - 1) in main like you suggested?

Link to comment
https://linustechtips.com/topic/266389-function-help-c/page/2/#findComment-3630935
Share on other sites

Link to post
Share on other sites

OOH dear lord I swear i did that and it gave me an error haha is it strange to say I love you lollllll  It did generate nothing like you said... so should i decrement cards *(deck + i - 1) in main like you suggested?

That's not quite right. Using *(CARDS + i) is only going to give you the first 5 members of the array. You need to use something else instead of i

 

Remember, you need to match the contents of the other arrays to the strings in CARDS.

Link to comment
https://linustechtips.com/topic/266389-function-help-c/page/2/#findComment-3630962
Share on other sites

Link to post
Share on other sites

void DisplayCards (int *user, int *generatedCards)        {                                                 cout << "Users Guess" << "\t\t\t" << "Generated Cards" << endl;             cout<<"***************************************************"<<endl;    for (int i = 0; i < 5; ++i) {        // Get the names of the choices from the deck        std::string UserChoice = (*(CARDS+i));       std::string GeneratedCard = (*(generatedCards+i));        // print the names side by side        cout << UserChoice<< "\t\t\t" <<GeneratedCard<< endl;    }

 

 

And I get the error  [Error] invalid conversion from 'int' to 'const char*' [-fpermissive]

for generated cards

Link to comment
https://linustechtips.com/topic/266389-function-help-c/page/2/#findComment-3630975
Share on other sites

Link to post
Share on other sites

So, something like

 

  std::string UserChoice = (*(CARDS+user));

 

?

 

Edit:You must hate me man lol I'm basically a toddler with c++ I'm asking the stupidest questions.

 

Haha don't worry.

 

You're really close with that one. Remember, user points to the first value of the array but it wont change when i is increased.

Link to comment
https://linustechtips.com/topic/266389-function-help-c/page/2/#findComment-3631032
Share on other sites

Link to post
Share on other sites

std::string UserChoice = (*(CARDS)+(*(user));
       std::string GeneratedCard = (*(CARDS)+(*(generatedCards));

 

I think this is what you mean?

 

But I am getting the error    [Error] no match for 'operator+' in '*(std::string*)(& CARDS) + * user'

Link to comment
https://linustechtips.com/topic/266389-function-help-c/page/2/#findComment-3631143
Share on other sites

Link to post
Share on other sites

std::string UserChoice = (*(CARDS)+(*(user));

       std::string GeneratedCard = (*(CARDS)+(*(generatedCards));

 

I think this is what you mean?

 

You're very close. Here's what you need.

*(CARDS + *(user + i))// *(user + i) will be familiar to you since you've used it so much// You're using that to get the value out of user in each loop.// Example// if *(user + 3) contains the value 4// Then what we are doing is getting the value in *(CARDS + 4) (ie: blue circle)

Hope you understand.

Link to comment
https://linustechtips.com/topic/266389-function-help-c/page/2/#findComment-3631215
Share on other sites

Link to post
Share on other sites

I do not :( I have until 11:58 to turn this in. Madknight if you finish this block for me I will design you the sickest avi or signature or both ever.   After that I get this error

 

 

 

void DisplayCards (int *user, int *generatedCards)
        {
            
            
            
             cout << "Users Guess" << "\t\t\t" << "Generated Cards" << endl;
             cout<<"***************************************************"<<endl;

    for (int i = 0; i < 5; ++i) {
        // get the names of the choices from the deck
        std::string UserChoice = *(CARDS + *(user + i));
       std::string GeneratedCard = *(CARDS)+*(generatedCards+i));

        // print the names side by side
        cout << UserChoice<< "\t\t\t" <<GeneratedCard<< endl;

 

 

  [Error] no match for 'operator+' in '*(std::string*)(& CARDS) + *(generatedCards + ((sizetype)(((long long unsigned int)i) * 4ull)))'

Link to comment
https://linustechtips.com/topic/266389-function-help-c/page/2/#findComment-3631229
Share on other sites

Link to post
Share on other sites

Is this correct?

 

 

  std::string UserChoice = (*(CARDS) + (*(user + i));
       std::string GeneratedCard = (*(CARDS)+(*(generatedCards+i));

 

I'm getting this:

Error] no match for 'operator+' in '*(std::string*)(& CARDS) + *(user + ((sizetype)(((long long unsigned int)i) * 4ull)))'

Link to comment
https://linustechtips.com/topic/266389-function-help-c/page/2/#findComment-3631292
Share on other sites

Link to post
Share on other sites

Lmao really? Gahd...

 

 

 std::string UserChoice = *(CARDS + *(user + i));
       std::string GeneratedCard = *(CARDS)+*(generatedCards+i));

 

Thats what I have now and either way I have them I get the same unfortunate error... ooh lord.. 4 minutes

Link to comment
https://linustechtips.com/topic/266389-function-help-c/page/2/#findComment-3631329
Share on other sites

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×