Forum: C Jun 3rd, 2006 |
| Replies: 17 Views: 6,989 goto was the first thing that came to my mind.
recursion was the seconed thing.
But in any case we are not allowed to test with "if".
I tought about simple condition like this
i = ( i < 10... |
Forum: C Jun 2nd, 2006 |
| Replies: 17 Views: 6,989 I too failed to solve "A 'C' program without using any loop (if, for, while,etc...) to print numbers."
unless it is somthing like
printf("1, 2, 3, 4....\n");
;)
Google nither... |
Forum: C Jun 2nd, 2006 |
| Replies: 9 Views: 1,304 |
Forum: C May 30th, 2006 |
| Replies: 9 Views: 1,304 I apologize for upsetting you.
Sorry.
But maybe someone else will have a better solution. |
Forum: C May 30th, 2006 |
| Replies: 9 Views: 1,304 |
Forum: C May 28th, 2006 |
| Replies: 9 Views: 1,304 Thank you guys, Lerner and Salem.
But I wasnt interstead in the way to implenent the code.
But rather, other ideas then mine to find node 10. |
Forum: C May 27th, 2006 |
| Replies: 9 Views: 1,304 This is/was an interview question I got two weeks ago.
Find where the loop begins in simple linked list.
I hope this figure will help understand what I mean :
[1] ->[2] ->[3] ->[4] ->[5]
... |
Forum: C May 27th, 2006 |
| Replies: 5 Views: 3,009 Thanks.
I tougth so, but wanted to be sure.
At least you figured out my figure,
which means that my drawing skills
are improving.
Thanks again. |
Forum: C May 27th, 2006 |
| Replies: 6 Views: 2,420 I already told you. Dont do this :
free(top);
top=top->next;
Its very wrong !!!!!
And still you do it again !!!!
:mad: |
Forum: C May 27th, 2006 |
| Replies: 6 Views: 2,420 The logic should be like this :
while ( input != 13 )
{
if input is '(' or '{' or '[' or ')' or '}' or ']'
{
if input is '(' or '{' or '['
... |
Forum: C May 27th, 2006 |
| Replies: 5 Views: 3,009 By saying "how i can find a loop in simple linked list"
do you mean like in my little drawing ?
( In a "normal linked list cell 10 would have point to NULL")
[1] ->[2] ->[3] ->[4] ->[5]
... |
Forum: C May 20th, 2006 |
| Replies: 4 Views: 861 void insertSortedList (Node **head, int value)
{
/* creating a new node */
Node *ptr = createNode (value);
Node **pCurrent = head;
/* adding the new node to the correct place in the list... |
Forum: C++ May 13th, 2006 |
| Replies: 3 Views: 2,409 I am not sure I understand you.
But if you want to replace found words in the puzzle with dots,
here goes :
first change :
char puzzle[MAXLENGTH][MAXLENGTH];
to |
Forum: C++ May 6th, 2006 |
| Replies: 9 Views: 1,370 Yes , you might declare tocont as integer or even
as char. |
Forum: C++ May 5th, 2006 |
| Replies: 9 Views: 1,370 >> my program doesn't brake, when '0' is entered as the buss number
Because you break from the for loop, but not from the
while loop.
I suggest a flag like "tocont"
tocont = 1;... |
Forum: C++ May 2nd, 2006 |
| Replies: 6 Views: 1,157 Maybe its installed but not in your path.
try to run as root.
find / -name gcc
I cant belive it wasnt installed with default installtion. |
Forum: C May 2nd, 2006 |
| Replies: 2 Views: 3,839 Your coping the same value (temp) for all the fileds :
strcpy(newCat->categoryID, temp);
newCat->drinkType = temp[0];
strcpy(newCat->categoryName, temp);
... |
Forum: C++ Apr 28th, 2006 |
| Replies: 1 Views: 2,772 The declatrion of class is good.
class project
{
public:
project();
int get_value();
void sort_values(int value[]);
void search_values(int value[]);
private: |
Forum: C Apr 27th, 2006 |
| Replies: 30 Views: 23,428 Well. I also think that it is wrong.
But poor me, does'nt know wheter 0,1,2 are prime.
I know that prime will divide by himself and one only.
I Guess you are right.
Anyway. is there someway for... |
Forum: C Apr 27th, 2006 |
| Replies: 10 Views: 2,271 first of all you did'nt initalize i !!!
The a close look at this program.
int product(int n);
int main(void)
{
char buf[100];
int num; |
Forum: C++ Apr 27th, 2006 |
| Replies: 1 Views: 905 You have at least two errors :
1) The function call.
2) Variable declartion.
The a look at this program.
/* function prototype.
For every call to print, the
compiler... |
Forum: C Apr 26th, 2006 |
| Replies: 30 Views: 23,428 I dont know that high math, but I think I can do better.
bool isPrime(int n)
{
bool prime ;
int lim;
if ( n == 0 || n == 1 || n % 2 == 0)
return(false); |
Forum: C Apr 24th, 2006 |
| Replies: 5 Views: 2,032 Why do you hate fgets. Its my faviorate function.
char* fgets(char *s, int n, FILE *stream);
fgets reads at most the next n-1 characters into the array s, stopping
if a newline is... |
Forum: C++ Apr 23rd, 2006 |
| Replies: 9 Views: 2,428 I can tell you on unix. To create a parent, you run a process.
To create a child for this process, use fork.
further is family of exec() function's. |
Forum: C Apr 23rd, 2006 |
| Replies: 2 Views: 730 Take a close look at the code I replaced.
Try to compile with extension .c
Look for "Notice : "
If you want to delete an item from the list, why dont
get input from user which student name... |
Forum: C++ Apr 23rd, 2006 |
| Replies: 1 Views: 2,009 One error :
ptr.credit
ptr is a pointer to array.
The permssion problem with :
ptr[i].credit |