Okay, so I implemented everything mentioned above. The program "runs" sort of. It is not doing what I expected and I'm assuming it is because of trying to pass the array to the constructor. When I compile and run the program it is outputting:
Hand 1
25
4072544
33
2293672
1
4072568
9
32
17
32
Hand 2
25
4072544
33
2293672
...
User Profile
Collapse
-
Okay the array works perfectly. I had to use the second way you said it because the compiler didn't like it the first way. I'm getting an error with the constructor. The error is:
"new types may not be defined in a return type
return type specification for constructor invalid"
Any idea on how to fix it?
The code is:
Code:class Cards { private: int card[51];
Leave a comment:
-
Okay I understand the constructor now, but when you say:
You mean down in the main program, I understand that, but not entirely sure of how to pass it to the constructor. Do you mean that
Code:Cards theDeck(card[51]={101,102,103,104,105, 106,107,108,109,110, 111,112,113,201,202,203, 204,205,206,207,208, 209,210,211,212,213,
Leave a comment:
-
Program with Class Cards
Okay, so I am have a bit of trouble with my program. The program itself will deal two hands of cards, shuffle the deck, and then deal another two hands. At the moment I have most of the code down I believe, but I cannot for the life of me figure out how to declare the numbers that I want in the array of card[]. That and I cannot figure out how to do the constructor for the class, aka theDeck. When I complied it, it came up with the error "ISO... -
Alright I changed the code a bit and I am no longer getting errors on the getline. The current code I have is :
Code:#include <iostream> #include <istream> #include <iomanip> #include <string> #include <cstdlib> using namespace std; struct Date { char month[256]; char day[256]; char year[256]; };
Leave a comment:
-
I am still getting errors with the getline part of the code. I'm not sure exactly how to do it and tie it into the structure as well.Leave a comment:
-
Help with structure program
Hey, I am trying to write a program that allows someone to enter two separate dates and returns the later of the two. I.E. I input 2/14/2004 and 3/2/2004, so it outputs 3/2/2004. This is what I have so far:
Code:#include <iostream> #include <istream> #include <iomanip> #include <string> #include <cstdlib> using namespace std; struct Date
-
-
Wow... that fixed it all and made me feel stupid. Thank you so much!
Any ideas on how to change the first letter to a capital, other than having another string with capital letter words to start the copy into the second string?Leave a comment:
-
Random Windows Error
This program is a random sentence generator. I have it running.. more or less. When it complies I will get some correct sentences and I will get some sentences that don't even contain real words. Also each time it compiles I get a Windows error that says that it has to close the program, random when it happens. The program may get 5 sentences in and then get the error or it won't get any and get the error. The code is....
Code:#include
-
Thank you so much, that explained exactly what I needed. Also thank you for the embedded code information.Leave a comment:
-
Correct. I understand how to do it for one dimensional arrays, but don't have a clue for two dimensional arrays.Leave a comment:
-
Need Help Please
Hey, I have been browsing the site for awhile and find it quite impressive. I couldn't find an article that quite helped me out. I was curious as how to change the following program into pointer notation. Replies are much appreciated.
using namespace std;
const int row = 4;
const int col = 5;
int findMax(int [row][col]);
int findMaxC(int [row][col]);
int main()
{
...
No activity results to display
Show More
Leave a comment: