What have you tried so far?
And are you talking about a user entering text that will be converted to binary (and vice versa) or do you want to convert a text file to binary?
You need to make an...
Type: Posts; User: Kaelin
What have you tried so far?
And are you talking about a user entering text that will be converted to binary (and vice versa) or do you want to convert a text file to binary?
You need to make an...
^^^
???
To be honest, I'm not really sure where that post came from. I don't think there's any need to insult somebody for forgetting "the dreaded quadratic equation".
I know that some of us...
Wow - after seeing the solution it's hard to believe I didn't get it in the first place. Thanks all, for your help :)
Alas, my biggest problem with C++ - not the syntax, but the creative thinking....
Hi there,
I have been trying to find a way to generate a random number within a range other than "1-X".
For example, the user will enter the low extreme and the high extreme - 20 and 80...
If it is closing right after the text is shown it is probably because the input buffer still has a character in it - at least that's how I've been made to see it.
Try putting cin.ignore() before...
read his code, it's very simple
With a little common sense, you could do a search (CTRL+F) to see where else he uses that variable. Oh, surely enough - he has a while loop that will terminate once...
Oops, you'll also want to make sure the input variable is a char.
Then instead of
case 1 : ....
you want
case 'y' : ....
void main is not alright, it doesn't matter how simple the program.
void main() is not portable code because only some compilers will "fix" this for you.
Notice the word "fix" :)
I would start by loading the file into memory.
Does the file have a new config variable on every new line? If so, you can just read the first characters, up to white space into a string as the...
change void main() to int main() and return 0. Many a compiler will complain about this, as will many a poster here :)
It looks like that might be why it's complaining -
-Edit-
Obviously...
As far as I know, calling main() is no longer allowed..
I'm a noob so I can't really help except that I know calling main is a big no-no :D
With AND, both expressions MUST equal true. If EITHER ONE fails, the whole thing will fail.
With OR, either one of the expressions must be true. Therefore, if one fails, one is still true and it...
I guess for something that only uses 6 numbers you could do something sloppy like add each random number you generate to an array and for each generation check that array to see if the new number is...
And close int main().. LOL
Hehe, do a preg_replace for all void mains. Secretly (or, well, not so secretly) forcing int main into the minds of all! *evil grin*
What you need to do is figure out the math first, THEN worry about the C++.
Draw these arrays on paper. On paper, can you perform the operations? If not, this is a mathematics issue and not a C++...
% in C++ is the modulus operator - NOT percent. C++ does not have an operator to take the percentage.
Modulus performs division and returns the remainder. If there is no remainder, the division...
Duh. Another hint: It's always best NOT to listen to me if it's before 9am :) LOL
Well, what do you have so far? Or did you want somebody to write the whole program for you? If this is for homework, that's not something this board is really for..
I would start by creating the...
Just an FYI - this post violates the thread naming policies of this board. Please be more specific with your titles.
Well, back when I was in school, teachers also tought indentation :)
-Edit-
In fact, I'm fairly certain one of the first things we learned was how to make legible code - indenation and...
Exactly - I suspect this might be where the problem lies. Radians are ugly numbers, almost always involving a decimal point. Degrees are often the opposite - 270deg, 60 deg, 45 deg, etc.
I think...
What are you doing with it?
You either need to use it in an expression or assign it to a variable.
float accepts decimal values. Integers, as you know, cannot - int in C++ is the same as a...
Are you assigning it to an integer variable? Make sure you're using a float.