Forum: C Jul 30th, 2009 |
| Replies: 11 Views: 576 C was originally developed for the express purpose of writing an operating system; Unix to be exact. Admittedly Unix can only be described as the work of an evil misanthropic genius. |
Forum: C Jul 29th, 2009 |
| Replies: 11 Views: 576 Most of Windows was written in C. You might or might not think that is marvellous. |
Forum: C Jul 21st, 2009 |
| Replies: 3 Views: 514 You write a shell the same way you write any other application program; it just happens to be the one which gets automatically loaded after the OS has finished booting. Of course it needs to be able... |
Forum: C Jun 27th, 2009 |
| Replies: 11 Views: 619 Well firstly, unless it is compiler specific, I have never seen %i before. A decimal integer is usually %d.
Secondly, given what you are doing, you presumably want the user to enter a positive... |
Forum: C Jun 27th, 2009 |
| Replies: 11 Views: 619 #include <stdio.h>
#include <stdlib.h>
int main()
{
int number;
int sum;
int i;
printf("please enter the end number : \n" ); |
Forum: C Mar 10th, 2007 |
| Replies: 44 Views: 5,512 That still looks like C++ to me.
Use to scanf or gets to input data
If using gets, use atoi to convert a string of digits to an integer
Use printf to output the result. |
Forum: C Mar 9th, 2007 |
| Replies: 9 Views: 7,667 I will suggest a possible approach rather than give an answer. Think of the values contained in the array as being the digits in a number with an appropriately large base. The hash value, or at least... |
Forum: C Mar 9th, 2007 |
| Replies: 9 Views: 7,667 Nothing easier than to map integers onto characters; a look up table would do it, but how would that help? |
Forum: C Mar 5th, 2007 |
| Replies: 5 Views: 1,463 To append a comment to the previous. If you allocate an array of structures by using calloc you do not really need a linked list at all - unless you are, or might be, allocating more structures... |
Forum: C Mar 4th, 2007 |
| Replies: 5 Views: 1,463 [quote=donaldunca;324408]
printf("do you still want to create?(y/n):");scanf("%s",&tl);
getch();
It isn't obvious why you need getch() there if you are using scanf to read... |
Forum: C Mar 4th, 2007 |
| Replies: 14 Views: 4,443 Print( int i, int incr, int stop )
{
// if i equals stop value, return
// print i asterisks with spaces
// Print( i + incr, incr, stop )
// return
}
PrintDiamond(... |
Forum: C Mar 3rd, 2007 |
| Replies: 44 Views: 5,512 You have declared a variable called n, and you have declared another variable called N. You should pass n to the second pow function, but instead you are passing N. |
Forum: C Mar 1st, 2007 |
| Replies: 44 Views: 5,512 I can see the mistake:
if( ( a[fN] > pow( 10, n - 1 ) - 1 ) && ( a[fN] < pow( 10, N ) ) )
Note the upper case N in the second call to pow. In C N and n are two different variable names. You... |
Forum: C Mar 1st, 2007 |
| Replies: 44 Views: 5,512 The only thing I can think of is to try putting casts in front of the pow function:
if( ( a[fN] > (int)pow( 10, n - 1 ) - 1 ) && ( a[fN] < (int)pow( 10, N ) ) ) |
Forum: C Mar 1st, 2007 |
| Replies: 44 Views: 5,512 In the sequence, 2, 3, 5, 8, 13, 21, 34, 55, 89, 144 a three digit number, if that's the number of digits you want, doesn't appear until the tenth iteration, so are you going round the loop enough... |
Forum: C Feb 28th, 2007 |
| Replies: 44 Views: 5,512 for ( fN = 2 ; fN <= i ; fN++ )
{
a[fN]=a[fN-1]+a[fN-2];
if( ( a[fN] > pow( 10, n - 1 ) - 1 ) && ( a[fN] < pow( 10, N ) ) )
cout << a[fN] <<"\n";
}
If, for example, you... |
Forum: C Feb 28th, 2007 |
| Replies: 14 Views: 4,443 Each time the function is called you need to print just one line of asterisks, and then recursively call the function to print the next line of asterisks. Obviously, with each call the line of... |
Forum: C Feb 26th, 2007 |
| Replies: 44 Views: 5,512 If n is the number of digits you want to output, and f is a fibonacci number, you need to check that:
f > pow( 10, n - 1 ) - 1
and
f < pow( 10, n )
As it stands the program is in C++.... |
Forum: C Nov 21st, 2006 |
| Replies: 5 Views: 1,512 At the risk of sounding as if I have got a big head, I'm sure I'm right. I suppose have been writing C programs since about 1987, and usually they are between 20 and 30 thousand lines long. But I... |
Forum: C Nov 21st, 2006 |
| Replies: 5 Views: 1,512 I take it that it's the left hand size which is puzzling you.
nDesIndex >> 3
Shift the value in nDesIndex right 3 places. Judging by the right hand side another index is stored in the first... |