419 Posted Topics
Re: Everything seems fine except your prime number checker. Check this thread [URL="http://www.daniweb.com/forums/thread224686.html"]here[/URL] Check out firstPerson's function within his post. | |
Re: I would make the checkGuess() take in 2 integers that the user inputs with cin ( int num, denom ) and then compare it to the reduced fraction in f3. [CODE]int num, denom; cout << "num: "; cin >> num; cout << "denom: "; cin >> denom; f3.checkGuess(num, denom);[/CODE] The … | |
Re: When I made my "Tile" game I ran into the same problem. I had a class called Tile and it held information for 1 square. Then I had a class called Board and this had a vector of Tiles within it. The problem that I had was that if I … | |
Re: First off, when you post in the future you should use the code tags to make it way easier to read. Last time I checked your main() function has to return an int and you have it as a void function. [CODE]void main (void) { mainProgram(); }[/CODE] I don't know … | |
Re: [QUOTE]1. When I insert elements into the vector, I cannot insert an element higher than 1.. only 0's and 1's.[/QUOTE] What is DEFAULTSIZE set to because if it is 1 then yeah 0s and 1s are within the range you set in your if() statement. [QUOTE]2. When I dump the … | |
Re: This seems like a pretty bad homework assignment seeing how you can only use a few coins to get 10000 dongs. This is what I put together really quick. It's not done you need to come up with an output and you might wanna double check to see if the … | |
Hey I was wondering how the string class is able to output its self the way it does. For example: [CODE]#include <iostream> #include <string> using namespace std; int main() { string testString; testString = "Hello"; cout << testString << endl; system("PAUSE"); return 0; }[/CODE] If I were to try to … | |
Re: You can use this to encrypt your string. [CODE]void EncryptableString::encrypt() { for( int i = 0; i < content.length(); i++ ) { if( (content[i] >= 'a' && content[i] < 'z') || (content[i] >= 'A' && content[i] < 'Z')) { content[i] += 1; } else if( content[i] == 'z' || content[i] … | |
Re: OK so I wrote out all your code into a new project and since this is just a short example I am going to give you what I got. [CODE]#include <iostream> #include <string> using namespace std; struct weapons { string name; int str; }; struct user { string name; int … | |
Re: What does your maze look like? You just give the start and finish points. | |
Re: Just add [CODE]cin.ignore();[/CODE] at the bottom of your for() loop for input and this will ignore the '\n' character from the last cin. Also it looks like you do not have [CODE]#include <iostream> [/CODE] at the top of your file for cin and cout usage. | |
Re: Most programs do their actions on key up. A way around this is to make a bool variable and make a KEY_UP if() statement. For example: [CODE] bool upKey; if( KEY_DOWN(VK_UP) && !upKey ) { upKey = true; //actions } if( KEY_UP(VK_UP) ) { upKey = false; }[/CODE] I'm not … | |
Re: I'm not 100% sure what you are asking is this correct? [CODE]#include <iostream> #include <string> using namespace std; int main() { string arrcon[2]; arrcon[0] = "John"; arrcon[1] = "56"; for( int i = 0; i < 2; i++ ) { cout << arrcon[i] << endl; } system("PAUSE"); return 0; } … | |
Re: I have looked over the code and got it working. However, I guess I cannot post the code or I could lose reputation. The big thing I you should do is reread your code because I found lots of typos and missing statement endings '}'. Also, take a look at … | |
Re: Here is what I came up with. "mystuff.h" [CODE]#ifndef MYSTUFF_H #define MYSTUFF_H void randomize(); int random( int high, int low = 0); int getMax( int A[] ); int getMin( int A[] ); int swap( int A[] ); #endif [/CODE] "mystuff.cpp" [CODE]#include <time.h> #include <stdlib.h> #include "mystuff.h" void randomize() { srand(time(NULL)); … | |
Re: I would put a while() loop with a bool variable in it [CODE]while(!done)[/CODE] and every time you win a point you add 1 to your score and 1 to the computers score when he wins. When one of the scores reach 2 then just make done = true and the … | |
Re: First off, I think you are missing a semicolon at the end of your SavingsAccount class (line 14, Account.cpp). For your withdraw and deposit functions you could use: [CODE] ///savings class void SavingsAccount::withdraw(double amount) { balance -= amount*(1+WITHDRAW_FEE); } void SavingsAccount::deposit(double amount) { balance += amount; } //checking class void … | |
Re: Why are you using a multidimensional array? If you explain a bit more stuff I might be able to help. | |
Hi I have been trying for a while to make a win32 app client be able to talk to a server app that I put on my friends computer. I am not 100% sure if the problem is caused by the fact that I have two routers which may interfere … |
The End.