Actually in the real code I did. I just got a little too quick with my keyboard....my bad.
Type: Posts; User: kryonik
Actually in the real code I did. I just got a little too quick with my keyboard....my bad.
Found an easier way to do it.
Ive never heard of cast. I'm not using constants so I'm not sure how const_cast would help.
Can anyone explain how this is done.
I am importing a couple values from a class and trying to divide them to get a fractional output from two int variables. I currently get a 0 for a and b when...
I can put in 80 * 120 and get 9600.
If I put in 222 * 444 I get a -504.
Thats where the logic fails and I'm not sure why.
I've been trying to build a calculator that gets around the limitations of int variables by splitting the number into smaller chunks. I've gotten the add to work successfully but have not been able...
I need some way to seperate either by commas or seperate into 3 digit pieces after the fact.
I am trying to fill an array with a large number using cin. What I would like to do it take a number like 123,456,789 and put it into someArray[0] = 123, someArray[1] = 456, etc. Can this be done...
I've got an apparent logic problem that I can't seem to solve. This program should open a text file and search for a terminal and then print the entire line.
It does not work as it should and I...
jafet, thats some awesome code there ;-) I will be using it to get as an example for some other things I need to learn how to do.
I think dwks answered the simple question. Doubles can't work...
I have tried in vain to debug this. The logic seems to fail around dimes. For most of the values I put in, the logic works fine. However sometimes, there will be a "penny" left in difference and...
Im working on a program that is supposed to return a class average using a struct. I've found some examples that get me in the right direction, but at the moment, Im not getting very far in...
I was working on the same thing. I tried isdigit and couldnt seem to get the logic quite right. Thanks to your advice, I solved my problem this way:
#include <stdio.h>
#include <ctype.h>...
Im trying to use isdigit to invoke an error if a string has anything other than a digit in it and having no luck. My old code line will kick out something that starts with a non integer value, ex....
quzah,
I appreciate your help in jogging my thought process. I re-did it using a strcpy and for the moment left the scanf in place. Its not pretty but it works which is all I had to do. Now Im...
Im going to use fgets on my own. But I'm supposed to use scanf to get the input. The only thing I can think of at the moment would be to utilize another temp variable to capture the input string...
My compiler didnt give me any warnings about it. It compiled and ran as I posted it. How would I change my code so that I can take an input string from the keyboard until \n is reached and then...
I'm trying to understand strcmp and not having much luck with it. What Im trying to do is input and compare 7 character strings with strcmp, re-order them accordingly and print out the result. I...
I'm going to post the whole section of code. The program itself spreads itself over 5 files. The logic I used was to return the players_choice and machine_choice to report.c. The problem seems to...
I had this fixed by doing the following:
case win:
++*win_cnt_ptr;
//printf("%27sYou win.\n", ""); //old code
printf("%s%s%s%s%s\n", "You chose ", names[player_choice],
" and...
I'm trying to figure out how to print an enum variable name verses the enum value. currently my code looks something like this. It prints the numeral 0-2 verses the enum that corresponds with the...
Thanks!
It didnt quite fix the problem, but it got me going in the right direction, and now the program works like a champ.
I wrote a program that is supposed to take a chinese prime number factoring algorithm and print a list of x prime numbers. The code compiles with no errors and runs. But the program does nothing. ...
Thanks for clearing that up!
Im using the book c by dissection and the exercise specifically asked you to write the function isvowel. I do however understand IRL you would do it as you asked.
Im using visual studio to...