- Strength to Increase Rep
- +6
- Strength to Decrease Rep
- -1
- Upvotes Received
- 20
- Posts with Upvotes
- 18
- Upvoting Members
- 13
- Downvotes Received
- 1
- Posts with Downvotes
- 1
- Downvoting Members
- 1
Re: You're doing the calculations before you're getting the number, and since num will be 0 at that point, tens digit and ones digit will always equal zero, no matter what. You need to take in your number THEN do the calculations for tens digit and ones digit. | |
Re: You may want to start with a loop, to take in the digits. Make sure you have a way to ensure that, when added, if a digit exceeds 10, it gets added to the higher digit. Also, remember that arrays begin with [0] and not [1], when you're programming the … | |
Re: Your array is not two-dimensional. I also suggest using a variable for input as opposed to just defining every possible outcome. You're setting yourself for one tedious and hard to follow jumble of code. An example: [code] unsigned short x,y; cin >> x >> y; myArray[x][y]= 'X' [/code] This takes … | |
Re: I smell homework. Read up in your reference book on implementation of pointers. | |
Re: [QUOTE=jonspeidel;1688769] [CODE]#include<iostream> #include<windows.h> #include<conio.h> #include<strings.h> using namespace std; int main(); void repeat(); void worked(); string s1; string s2; string s3; int main() { repeat(); } void repeat() { string s3="n"; cout << "Would you like to perform another operation?\n"; cin >> s3; if((s3=="Y" || "y")) { worked(); } if((s3=="N" || … | |
Re: [code]if (conversion !=1|| conversion !=2|| conversion !=3|| conversion !=4|| conversion !=5|| conversion !=6)[/code] Can be changed to [code]else[/code] Since the above is implied through the preceding code. Also be careful with your brackets. Line 73 is the end of your do loop and line 76 is the end of int … | |
Re: How can your application send you anything without some form of internet activity? | |
Re: [QUOTE=jackmaverick1;1689724]I think there's a char code that you can use. (like /20?)[/QUOTE] Blank space IS a char. [code] #include <iostream> using std::cout; int main() { char c = ' '; cout <<"Space" << c << "is" <<c <<"a"<<c<<"Character."; cout <<"\nAscii code = " << int(c); return 0; } [/code] Note … | |
Re: [code]Person::Person(string first = "", string second = "")[/code] Out of curiosity, what are you tying to accomplish with your parameters? | |
Re: Just open an output stream and save them to a text file, you're already halfway there. | |
Re: 1. You're not using a char variable, you're using an integer variable. Integers are strictly numerical. 2. Character variables can only hold 1 character. This is due to size limitation of the variable. You will need an array characters to accept input with more than one character. If this sounds … | |
Re: You're asking for input of a character but your variable is an integer, which can only be numerical. The problem your seeing is common to mis-matched variable types. A for loop is also the incorrect type of loop for this particular function. The loop outlined above would serve your purpose … | |
Re: You have your array declare globally, I'd change that. Also, try declaring the range of the array inside your function. I'd imagine by the nature of multidimensional arrays your compiler will want that specified. Example: [code]myfunc(int array[0][5]) //change the '0' to '5'.[/code] | |
Re: [QUOTE=shizu;1494701]Hi luce.. I try your code already.. once compile I get error message like below show.. ****************************************************************** error C2065: 'Image' : undeclared identifier error C2146: syntax error : missing ';' before identifier 'image' error C2065: 'image' : undeclared identifier error C2065: 'GetEncoderClsid' : undeclared identifier error C2228: left of '.Save' … | |
Re: [url=http://advancedcppwithexamples.blogspot.com/2009/08/measuring-elapsed-time-in-c-using_21.html]QueryPerformanceCounter[/url] 20 pixel per second = 1ms x 50 per pixel. Perform the check via subtraction and if the time difference exceeds 50, move one pixel. Of course, you'll then need to reset the "clock" so to speak. Alternatively, you could just grab the time via Clock(), that measures the … | |
Re: You're skipping your if loops: [code] if (gamechoices == "Attack" || gamechoices == "fight" || gamechoices == "kill");[/code] The semicolon ";" at the end terminates the if statement. You need to place anything that will be executed within your if loops within brackets "{ }". It's a common mistake since … | |
Re: 1.Make sure everything is kept as a character; use some denotation as terminator so you can have multi-digit numbers without much difficulty. 2.Convert these chars to their ASCII equivalent integer. If the ASCII value of the char is between 0-9, give it precedence over any non-integer character. A simple boolean … | |
| Re: Why the use of strings? Boolean statements would work just as well(better even): [code] bool seat[200]; [/code] And then... [code] if (seat[input] == 1) cout << "Seat Number" << input << "is reserved. Please choose another."; else seat[input] = 1 [/code] And there you go. Your 500 hundred line case … |
Re: [QUOTE=Moschops;1486526]Your divides function takes two int objects as parameters, and returns an int. Accordingly, you must call it like this: [CODE]returnedInt = divides (someInt, someOtherInt);[/CODE] where [B]returnedInt[/B], [B]someInt[/B] and [B]someOtherInt[/B] are all of type [B]int[/B].[/QUOTE] Or, he could use an if statement to check the returned value like so: [code] … | |
Re: Why use a queue at all? The queue is only gonna return the same thing as your string in the first place. Remember the nature of a stack. A stack is somewhat unfair and believes that the last person to come should be the first to go. Think of a … | |
Re: [QUOTE=Fbody;1484874]So are you saying that you can generate closed-source code, and use a license of your choosing for it, so long as you have an appropriate notice concerning, and provide access to, the MySQL License and Source in compliance with the GPL?[/QUOTE] Read more about the GPL [url=http://www.gnu.org/philosophy/selling.html]here[/url]. | |
Re: Just to clarify, the prototype is what tells the compiler that the function exists, so if another function calls that function before it is actually defined, the compiler knows it exists and doesn't need to throw an error at you. A class declaration (as you've shown), is the same thing. … | |
Re: [QUOTE=schrope;1481422]that is what i thought but it is not working-- i rewrote the last line of code digit_two+=7%10; //add digit_two to 7 and mod 10 digit_three+=7%10; //add digit_three to 7 and mod 10 digit_four+=7%10; //add digit_four to 7 and mod 10 cout <<"Encrypted digits:" << digit_three digit_four digit_one digit_ two … | |
Re: [QUOTE=FriXionX;1478480]Gah, so confusing. I'm gonna learn a bit more, then come back to this, because i dont really understand at the moment. Thanks for the help anyway, ill refer back to this later.[/QUOTE] You should probably find a textbook or some sort and learn from that. If you follow it … | |
Re: You're not looping because s2 doesn't equal anything. Don't use goto, you have the right idea with a loop, you just need to fix your execution. Either: 1. Ask for the input of s2 before ending your loop. 2. Check s1 for a specific input and if it equals that … | |
Re: Hint: You can check the validity of the board by the sum of all the numbers within a given column or row. | |
Re: To see every available character, compile and run this code, if you can make the "cent" symbol in a char or string, it'll be there: [code] #include <iostream> #include <iomanip> using namespace std; int main() { char c; for (int x = 0; x <= 255; x++ ) { c … | |
Re: Your if statements aren't doing anything to begin with. You may want to carefully reexamine if statement implementation. | |
Re: We'll need to see your code to know what's wrong with it. | |
Re: Well, this isn't C++. Also, I don't fully understand the question. You simply specify that Column before you perform the action. There's not much else to it. |