Search Results

Showing results 1 to 23 of 23
Search took 0.07 seconds.
Search: Posts Made By: Sci@phy ; Forum: C and child forums
Forum: C Nov 2nd, 2008
Replies: 4
Solved: Sine Series
Views: 1,391
Posted By Sci@phy
And a little piece of advice. When working with decimal numbers, don't use float, instead use more precise double.
Forum: C Oct 26th, 2008
Replies: 10
Solved: Trie's in C
Views: 2,562
Posted By Sci@phy
Do you know why do you use typedef?
It's syntax should be:

typedef some huge type A_DEF;


And the code you wrote has no use from typedef since you haven't specified name that will replace...
Forum: C Oct 26th, 2008
Replies: 10
Solved: Trie's in C
Views: 2,562
Posted By Sci@phy
Funny:

typedef struct node {
char value;
bool isroot;
bool isend;
struct node* sibling;
struct node* child;
}; //<== if semicolon goes here, it's much more reasonable
Forum: C Oct 20th, 2008
Replies: 6
Solved: Help Please
Views: 530
Posted By Sci@phy
Although, if you're doing it for class of some sort, wouldn't it be better to make your own toupper? Just a thought.
Remember, letters are stored actually as ascii code, and you can "add" them or...
Forum: C Oct 19th, 2008
Replies: 24
Views: 8,719
Posted By Sci@phy
Ahh, I knew someone will say something like that :)
Of course it can be dangerous, so are pointers (but we still use those).



For first this I have only one answer: scanf("%40s", string);
For...
Forum: C Oct 19th, 2008
Replies: 24
Views: 8,719
Posted By Sci@phy
And yet, scanf can be clever function:

#include <stdio.h>

int main(){
char dump, string[40];

printf("Enter whole sentece (yeah, bring spaces too, I can handle it):\n");
scanf...
Forum: C Oct 17th, 2008
Replies: 6
Views: 791
Posted By Sci@phy
The only reason this code should give you error is if you input something else that float, let's say letter. So please post what number did you entered for its first input?

And please, write:
int...
Forum: C Oct 16th, 2008
Replies: 4
Views: 1,985
Posted By Sci@phy
You could write your hex-to-deci function, and then you can simply write
char a = hex-to-deci-function(hex_num)
Forum: C Oct 14th, 2008
Replies: 10
Solved: printf
Views: 869
Posted By Sci@phy
Thank you for your answers :)
Forum: C Oct 14th, 2008
Replies: 10
Solved: printf
Views: 869
Posted By Sci@phy
@Narue
I see you are using goto.

And I know programmers don't like to use goto, so if I may ask: why? :)
Did you just use it because it's fastest to write code like that?
Or would you still use...
Forum: C Oct 12th, 2008
Replies: 10
Views: 840
Posted By Sci@phy
It goes like this:
n(0) = 1;
n(1) = 1;
n(2) = n(1), n(2) //so it's actually two numbers
n(3) = n(1), n(2), n(3)...

Bottom line is: First two numbers just copy.
The print others in a for loop
Forum: C Oct 12th, 2008
Replies: 6
Views: 736
Posted By Sci@phy
Flushes everything (like a damn good toilet :) )
Forum: C Oct 12th, 2008
Replies: 7
Solved: Weird error
Views: 487
Posted By Sci@phy
Just some literature from wikipedia:
"In C99, there is a bool type, along with the values true and false, defined in the <stdbool.h>"
Forum: C Oct 12th, 2008
Replies: 15
Views: 1,079
Posted By Sci@phy
On line 22 you are declaring function. There's no semicolon in the end.
Main is also a function. Do you write: int main();
Forum: C Oct 11th, 2008
Replies: 4
Solved: scanf problem
Views: 590
Posted By Sci@phy
I doubt that IT printed out properly. Maybe you retyped it, because on my compiler (gcc) problem is with blank space after last %d that exists in his code, and so scanf asks for continuation of...
Forum: C Oct 1st, 2008
Replies: 9
Views: 2,185
Posted By Sci@phy
This exact code works for me perfectly
Forum: C Sep 30th, 2008
Replies: 16
Views: 1,323
Posted By Sci@phy
Two problems that I see.
What about your input code? First you ask user to insert "a and n", but using scanf() you first get n, then a. That could be problem.

And on end of int main() add return...
Forum: C Sep 29th, 2008
Replies: 16
Views: 1,323
Posted By Sci@phy
Forum: C Sep 29th, 2008
Replies: 16
Views: 1,323
Posted By Sci@phy
Well, it says about 'n' not being initialised. Try to debug it yourself!
Forum: C Sep 29th, 2008
Replies: 16
Views: 1,323
Posted By Sci@phy
On line 7 you have:

int power (int n); // function prototype

And later you call your function:

float power(float a, int n)
Forum: C Sep 28th, 2008
Replies: 12
Views: 1,151
Posted By Sci@phy
Isn't negative factorial kind of wrong altogether?
Forum: C Sep 28th, 2008
Replies: 3
Views: 625
Posted By Sci@phy
I don't see a problem. You don't need this piece of code:

{
int old_number= 0;
int current_number = 1;
int next_number;

}
Forum: C Sep 27th, 2008
Replies: 12
Views: 1,151
Posted By Sci@phy
And why is it called return1??? It should be fact!!!
Showing results 1 to 23 of 23

 


About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC