- Strength to Increase Rep
- +7
- Strength to Decrease Rep
- -1
- Upvotes Received
- 38
- Posts with Upvotes
- 25
- Upvoting Members
- 22
- Downvotes Received
- 23
- Posts with Downvotes
- 14
- Downvoting Members
- 10
I'm the type of guy who says "I don't know the answer" if I really don't know the answer and who says "You're right and I'm wrong" if I really think so. And no, I didn't copy this from "In Pursuit Of Happiness".…
- Interests
- Varied
- PC Specs
- Computer Specs - Beyond hopeless! OS Flavor - Windows XP but I like the MAC OS (which means a hole through…
76 Posted Topics
Re: This type of problem is best solved with the help of recursion Here is the algorithm accept [number] if number is greater than 9 extract numbers and multiply them together till the original [number] becomes zero send the result as parameter to this function if number is not greater than … | |
Re: Even after starting C, most books (or links) only say what we should do. But the user(for me example) remains ignorant about the "DO NOTS", and by mistake, might indulge into the wrong programming practices. [URL="http://www.ibm.com/developerworks/aix/library/au-hook_duttaC.html"]This[/URL] link will surely help. | |
Re: Use [URL="http://sourceforge.net/projects/codeblocks/"]Code::Blocks [/URL] No problems and no hassles! | |
Re: [QUOTE=jonsca]I don't believe there is any standard method for reducing the text size.[/QUOTE] This is the crux of the problem. You cannot view more than 50 lines at a time in DOS mode (as far as i know). But there is a trick. It involves pausing the screen after every … | |
I've tried to make a [URL="http://en.wikipedia.org/wiki/Deque"]DEQUE[/URL] program. My book on data structures (Seymour Lipschutz) doesn't have an algorithm on DEQUES. Neither does [URL="http://www.itl.nist.gov/div897/sqg/dads/HTML/deque.html"]DADS[/URL] give a good description. All I heard was that it could be implemented better with two lists (one forward and one backward) & there are 2 types … | |
Re: I would suggest [URL="http://sourceforge.net/projects/codeblocks/"]Code::Blocks[/URL] | |
Re: I hate bringing up old threads but I was thinking about this but did not have the courage of asking a MOD but this seems like a good opportunity. So, can i make a list of Common malpractices of C? | |
Re: There you go [CODE]#include <iostream.h> #include <conio.h> int i; int a[10]; int main() { cout<<"\n\n\tEnter The 10 Numbers : \n"; for(i=0;i<10;i++) { cout<<"\t"; cin>>a[i]; } cout<<"\n\n\tThe 10 Numbers In Reverse : \n\t"; for(i=9;i>=0;i--) { cout<<a[i]<<"\t"; } return 0; }[/CODE] | |
I was writing a file copying program. Mind you this is an any file copier. That is, at this moment, this function can copy only text files but i'm trying to copy mp3 files, avi files, mkv files etc, which this cannot. Here is just the copying function. However it … | |
Re: Hello vanan4u These are your errors 1) You have declared the return type of main as void but returned an integer. It is recommended to use int main(). See [URL="http://www.gidnetwork.com/b-66.html"]here[/URL] 2) You have made a system call, however forgot to include the necessary header files for the function (stblib.h). However, … | |
Okay this program is really pissing me off! After line 95, the member variable is suddenly getting changed (That is, the 2nd string). Even after looking at it for 3 hours, I've failed to crack it :( Please help me out guys! [CODE] # include <iostream> # include <cstring> using … | |
Re: I would suggest you to read the chapter on pointers from your text-book before asking such questions here. These topics are covered in any standard books... Here is the syntax... [CODE] #include <iostream> using namespace std; void func(int array[]); int main() { int array[] = {10,20,30,40}; func(array); // func(&(array[0])); // … | |
Here is a very simple code demonstrating how 'protected' is used [CODE]# include <iostream> using namespace std; class A { protected : int a; }; class B : public A { public : void f_1() // * { a = 10; cout << a; } }; int main() { B … | |
Re: [CODE]#include<conio.h>[/CODE] This code hurts :O [QUOTE]I tried but could not find any other mistake which could have caused runtime error.. Can you please help!![/QUOTE] We here will not directly give you the answer. Check again. You'll find the error... Give us the new corrected code... | |
Re: [QUOTE]its so easy!!!![/QUOTE] It's the I-know-the-answer-but-I-won't-tell syndrome. It generally happens to people who suffer from I-don't-know-the-answer Don't be too hard on him... | |
Re: Wow! You're so close! Just fill in the last two functions and you're done. Then you'll see that you don't even need our help. You also need to attach the ass1.h file to your post and give proper code tags... | |
Re: Well, I'm a noobie but when I have to send an entire structure array, I just send the pointer to the 1st position of the array. Here is a sample code [CODE]# include <iostream> using namespace std; typedef struct AA { int a; }A; void print (A *struc_point) { cout … | |
Re: Dave, Will be [B]really[/B] missing you. Whenever I saw that Dave has replied to my post, it meant that my query has been solved. It's a shame that I couldn't know you better. All I know that you were a gifted programmer and a true gentleman, always polite and full … | |
Re: You know what, one could start a [U]Hall Of Fame[/U] for such posts like [URL="http://bash.org/?top"]Bash[/URL] We could show the new users what type of posts [B]not[/B] to make. | |
I've come across two questions from my previous years college test papers. I just couldn't solve them [LIST=1] [*][I]Define rational number as an ADT (abstract data structure)[/I] [*][I]Write a suitable C code to sort a finite set of elements where an element may appear a large number of times[/I] [/LIST] … | |
Re: If I ask you what does [icode]printf("Hello");[/icode] mean. You'll most probably say [QUOTE]It prints "Hello" on the screen[/QUOTE] but you didn't answer my original question about its...uh..."meaning" (which it doesn't have). You only stated its purpose. So please rephrase your questions If your questions were [QUOTE]What are the differences between … | |
Re: @aianne I would recommend you scrap that compiler (which supports non-standard header files) and get yourself a new one that supports C99 I would recommend [URL="http://sourceforge.net/projects/codeblocks/"]Code::Blocks.[/URL] | |
Re: Do you know this feature of characters in C? [CODE]char ch = 'A'; ch = ch + 1; printf("%c", ch);[/CODE] Output [CODE]B[/CODE] Now, you said ASCII code of 'A' = 65 & ASCII code of 'a' = 90, hence try to figure how much you should add/subtract from a character … | |
Re: What have you done so far? Could you show us that? | |
Okay, this time, i have to say it's a weird error. This code runs fine in Code::Blocks 8.02 but fails to run in my college compiler. I think my college compiler is the GCC Compiler (same as my home compiler) but in LINUX environment. Something like [CODE]vi sort.c cc sort.c … | |
Re: Are you trying something like this? [CODE] * *** ***** *******[/CODE] | |
Re: Are you trying to do something like this? [CODE]Enter The Number - 7 7 % 2 = 1 7 % 3 = 1 7 % 4 = 3 7 % 5 = 2 7 % 6 = 1[/CODE] Your for loop is a bit faulty. If you can correct that, … | |
Re: I just heard from a source that some systems treat [icode]return 0[/icode] as a "function gone wrong". So to avoid platform dependencies, one should use [icode]return EXIT_SUCCESS[/icode] Is this all correct? | |
Re: [QUOTE]Currently, i was assigned to create an array, [B]which i have no idea what array is[/B].[/QUOTE] Oh come on! Then I (along with several others) would suggest you to read your C Programming book before diving into such problems | |
Re: [QUOTE=mirness]it's about binary trees [B]but we'll use names instead of numbers or single chars[/B][/QUOTE] Can you make a binary tree using numbers or single characters? If you can, post that attempt. If you can't, you have to go back to square one and read the theory first. | |
Re: You might wanna see that in LINE # 20 & 21, you messed up the comments. It should be like this [CODE]printf("%s\n", s); /*Testing the string was infact inputted*/ for (i = 0; c != '\0'; i++)/*Traverses the character string until EOF*/[/CODE] I was just thinking, can we give more … | |
Re: LINE 13 - while(c < 5) When c = 4, array index is out of its bounds. The problem with C is that it C will not check for such array out of bounds conditions. The program will compile and run but will give the error at the end of … | |
Re: [QUOTE=iNach][CODE]#include <conio.h> #include <iostream> int main(int argc, char *argv[]) { char k; k = getch(); if (k==27) printf("ESC pressed.\n"); return EXIT_SUCCESS; }[/CODE][/QUOTE] Agreed but what are you going to do about this thing -> [icode]conio.h[/icode] Mind you, your code is not portable at this point. (Unless you make an exe … | |
I just received the MERGE SORT code from my friend, here it is [CODE]void sort_merge (int *array, int low, int high) { int mid; if (low < high) { mid = (low + high) / 2; sort_merge (array, low, mid); sort_merge (array, mid + 1, high); array_merge (array, low, high, … | |
Re: You could've posted a list of books you [U]didn't[/U] find useful. You can try [URL="http://pweb.netcom.com/~tjensen/ptr/cpoint.htm"]this[/URL] You should take it slow while studying this book | |
Re: [QUOTE]You cannot write [CODE]username == 'udental'[/CODE][/QUOTE] It's not that he cannot write it. Technically speaking, it's not a syntax error but it will always be evaluated to false. (At least my Code::Blocks compiler tells me that) As per my knowledge, we are trying to check the equality of two char … | |
Re: You could also do something like this [CODE] .... char input[10]; int converted_number = 0; int length; int i = 0; printf("Enter Input : "); fgets(input,10,stdin); input[strlen(input) - 1] = '\0'; if(strlen(input) > 2) // number is within 20 hence must be within 2 digits { printf("Invalid"); return 0; } … | |
Let's say we want to free the total memory used by a linked list in a program, I generally do it like this [CODE]typedef struct linked_list { int some_data; struct linked_list *link; }NODE; int free_memory(NODE * head) { NODE * temp = NULL; if(head == NULL) return 0; // FAILURE … | |
Re: @latszer Hello, LINE 17 - You cannot assign a array to another array I think you were trying to use the [icode]==[/icode] sign but it is not allowed for strings, i'e, [icode]username_1==usercheck[/icode]. It will not give any error but it will always be evaluated to false. Use [icode]strcmp[/icode] as Dave … | |
Re: [QUOTE]If you just have a text editor you can probably write a program to pare down your code to the strings (marked by a line number), import that into word, correct everything and make your changes by hand. [/QUOTE] But the problem with that method is that it will even … | |
[B]Here is the sample program[/B] [CODE]# include <stdio.h> # include <stdlib.h> // COMPILER : GNU GCC COMPILER // EDITOR : CODE::BLOCKS 8.02 struct test { int data; struct test *link; }; void change(struct test *ptr); int main() { struct test *fresh = (struct test *)malloc(sizeof(struct test)); int some_data = 10; … | |
Re: [CODE]#define CHK_REM_2_3_5( n ) ( REM_2( n ) && REM_3( n ) && (REM_5( n ) )[/CODE] @Gaiety I think there are more divisors other than 2, 3 & 5 Please clear your concept of prime numbers | |
| |
Re: [QUOTE=niek_e]When they give you this just put on a disgusted face and walk away[/QUOTE] Don't you think that they will feel that aspirant has chickened out after seeing the code | |
Re: And try not to use [icode]gets()[/icode]. It's an erratic function. To cut a long post short, look [URL="http://www.gidnetwork.com/b-56.html"]here[/URL] | |
Re: [QUOTE=Creator00]Could you please help me to solve this?[/QUOTE] Sure we could help you but at least show us what you have come up with so far | |
Re: [QUOTE=imolorhe]I have tried but can't [/QUOTE] Show us how much or whatever you have tried. Before moving into such questions on programming, think how you would solve the problem sequencially. Can you atleast do it without pointers, using array-index? [QUOTE=landonmkelsey]Assume matrices stored in column order[/QUOTE] In C, 2D Arrays lements … | |
The program generates a calendar for one year. The program only asks for the day on which 1st January falls from user. Notes : [LIST] [*]Compiler - Turbo C++ 4.5 [*]Leap year has been considered [*]The only reason for including [icode]conio.h[/icode] is because of [icode]clrscr()[/icode]. If somebody can give me … |
The End.