Forum: C Jul 25th, 2006 |
| Replies: 3 Views: 1,068 Why couldn't you split your code into seperate methods and execute a certain method when you need it? As Wolf said, goto is bad practice and I consider it old school :cheesy: |
Forum: C Jul 11th, 2006 |
| Replies: 13 Views: 5,346 Formula for each element:
R!
--------
C!(R-C)! |
Forum: C Jul 7th, 2006 |
| Replies: 3 Views: 964 looks an awfully lot like my old crap C code. |
Forum: C Jun 19th, 2006 |
| Replies: 4 Views: 3,845 It's my understanding that ::ate places you at the end of the file and allows you to write data anywhere in the file, however, writing to a specific location overwrites what was previously there.. I... |
Forum: C Jun 17th, 2006 |
| Replies: 41 Views: 7,444 I think you missed part/most of the defintion:
I'll just settle this in a PM with this dirt bag. |
Forum: C Jun 17th, 2006 |
| Replies: 41 Views: 7,444 Hey, ya know, what's wrong with a little excitement? I knew YOU would understand:cheesy:
Personal reasons. I was testing something stupid, but I just dropped it. I like Dev C++ too much. |
Forum: C Jun 17th, 2006 |
| Replies: 41 Views: 7,444 This seemed to work for me:
float num;
if (sscanf(text,"%f",&num) == 1 && num > 0) |
Forum: C Jun 17th, 2006 |
| Replies: 41 Views: 7,444 Oh, believe me, I did. I thought it through really well. I could have filled up a whole page on what I really wanted to say to that.... |
Forum: C Jun 17th, 2006 |
| Replies: 41 Views: 7,444 Wow, that makes me feel dumb. For some reason I was thinking %d for for double. Although, I believe I have tried %f with double and it gave weird results.
Why don't you head on over to... |
Forum: C Jun 17th, 2006 |
| Replies: 41 Views: 7,444 It's reading the 5.5, but for some reason it's being truncated in the conversion:
int num;
if (sscanf(text,"%d",&num) == 1 && num > 0) |
Forum: C Jun 17th, 2006 |
| Replies: 41 Views: 7,444 Because if I don't use that method and just print out some number it works.
I've used the following specifiers:
%f -- gives 5.000000
%.2g gives 5 ( g is the only one I know how to use to... |
Forum: C Jun 17th, 2006 |
| Replies: 41 Views: 7,444 I suggest you shut your big yapper [insert Moderator's profanity edit here]
Schools out tard. Java is the only thing taught at my school (when it's actually going on). |
Forum: C Jun 17th, 2006 |
| Replies: 41 Views: 7,444 Is there a reason why the fgets is delimiting a '.'? If I enter 5.5 it truncates to 5... How can I get around this? |
Forum: C Jun 17th, 2006 |
| Replies: 41 Views: 7,444 I am, but there's specific reasons why I was wanting to compile and run under Miracle C. |
Forum: C Jun 16th, 2006 |
| Replies: 41 Views: 7,444 Wow, it turned out that it couldn't comprehend this line:
sizeof text because parenthesis weren't there: sizeof(text)
Then, it's adhering to the age old standard of variables need to be... |
Forum: C Jun 16th, 2006 |
| Replies: 41 Views: 7,444 This is the real line by the way:
if ( fgets(text, sizeof text, stdin) )
{ |
Forum: C Jun 16th, 2006 |
| Replies: 41 Views: 7,444 Thanks for all the replies.
To Dave: I loved the way your tutorial was dealing with input, but Miracle C is giving me the following error on the fgets line:
Do you have any idea why... |
Forum: C Jun 14th, 2006 |
| Replies: 41 Views: 7,444 I have the following simple piece of code:
double new_amount;
printf("Enter an amount: ");
scanf ("%d", &new_amount);
For some reason, it always give me zero as the new_amount... |
Forum: C Jun 5th, 2006 |
| Replies: 5 Views: 798 I've stated this many times to others and they don't listen: Write a program that randomly selects a project for people like you. |
Forum: C Jun 4th, 2006 |
| Replies: 3 Views: 970 From what I remember, you can package the framework in your application, but I believe you need some sort of license... I could be wrong about that since it's been about 3 years. |
Forum: C Apr 24th, 2006 |
| Replies: 2 Views: 921 |
Forum: C Apr 17th, 2006 |
| Replies: 2 Views: 1,665 Ahhh, thank you. I was actually looking into using a typename, but in a different context. I've never really understood why you have to qualify it with that.
Thanks man. |
Forum: C Apr 17th, 2006 |
| Replies: 2 Views: 1,665 I've got the following code:
template <typename T> int Histogram<T>::get_occurances(const T& obj)
{
map<T,int>::iterator find_occur = frequency.find(obj);
if (... |
Forum: C Apr 3rd, 2006 |
| Replies: 25 Views: 9,533 My bad dragon. I assumed it was correct since it worked ;) |
Forum: C Apr 2nd, 2006 |
| Replies: 25 Views: 9,533 Yep it's pretty simple:
int main(int argc, char *argv[])
{
int x = 1000001;
cout << char(x) << endl;
getchar();
} |
Forum: C Mar 17th, 2006 |
| Replies: 3 Views: 6,418 Is it really that hard?
if(isalpha(char))
I don't know if that takes a string or not, but if it's only a character then just loop through. |
Forum: C Feb 17th, 2006 |
| Replies: 7 Views: 3,710 That was pretty funny, actually.
I thought about it, but it looks like more work than has to be done. |
Forum: C Feb 17th, 2006 |
| Replies: 7 Views: 3,710 Okay, you can STFU!
Well, I thought since I just magically knew the atoi() function existed, then I would magically know the parameter.
Thanks Narue. |
Forum: C Feb 16th, 2006 |
| Replies: 7 Views: 3,710 Okay, I can't find a thread that I posted to just yesterday and recieved an email showing a nice reply by Narue, but I deleted it. I can't find that thread! Was it deleted? If it was, Narue,... |
Forum: C Feb 16th, 2006 |
| Replies: 2 Views: 21,147 I think it's:
int x = atoi(char);
Probably better ways, but that's how I do it. |
Forum: C Jan 30th, 2006 |
| Replies: 3 Views: 6,430 That's what someone else said. Which compiler are you using? I'm using bloodshed. |
Forum: C Jan 29th, 2006 |
| Replies: 3 Views: 6,430 I have a matrix class which there are matrix objects. I want to call .value(int,int) directly on the matrix objects and set the internal 2d vector to the value on the right side of the equal sign. ... |
Forum: C Jan 20th, 2006 |
| Replies: 4 Views: 1,258 I thought the same thing, but the paper I'm reading from said all I have to do is #include the class and call the method (and the method was in a class). I didn't think that would work, and indeed... |
Forum: C Jan 19th, 2006 |
| Replies: 4 Views: 1,258 Sorry, it seemed to be a problem with something else. I fixed it, but it's not recognized my class that should have been imported:
I included the file:
#include "Card.h"
Which is a... |
Forum: C Jan 19th, 2006 |
| Replies: 4 Views: 1,258 I'm trying this:
char info[50];
myfile.getline(info, sizeof(info) );
double my_double = atof(info); |
Forum: C Dec 19th, 2005 |
| Replies: 5 Views: 8,390 Why use printf? Just use cout.
Also, why use a char array when the STL provides a string class?
If it's three or MORE people then use a vector since you don't know the exact size. |
Forum: C Nov 22nd, 2005 |
| Replies: 8 Views: 1,736 First off, I would suggest adding some tab characters "\t" instead of explicitly adding all the white spaces in. It makes your code really hard to read like it is. |
Forum: C Nov 18th, 2005 |
| Replies: 4 Views: 2,857 It might be. I was trying to recall from memory, so I wouldn't doubt it if I'm wrong. I'll check it out real fast. |
Forum: C Nov 18th, 2005 |
| Replies: 4 Views: 2,857 I thought it was strspn(parameters); ? |
Forum: C Nov 15th, 2005 |
| Replies: 15 Views: 3,012 |