Any ideas for me?

This is a discussion on Any ideas for me? within the C Programming forums, part of the General Programming Boards category; Hello, I have just recently finished a good deal of chapters in my C tutorial. I have very bad idea's ...

  1. #1
    Registered User
    Join Date
    Jul 2002
    Posts
    7

    Question Any ideas for me?

    Hello,

    I have just recently finished a good deal of chapters in my C tutorial. I have very bad idea's for projects to practice on, so if someone could give me an idea of what to program, I'd be most apperciated. Details especially. I know everything as detailed a file input and output, which should say I alot, I think.

    Plus, I plan on using my programming abilities to program games, don't know if that could help influence any project goals. I can't do graphics yet, and I don't really want anything too long, just something I can do in my quickly. Probably get done with it within the hour I start it or something. I know this probably sounds like a weird question, but I don't have too much creativity when it comes down to this aspect.

    Thanks!

  2. #2
    Code Goddess Prelude's Avatar
    Join Date
    Sep 2001
    Posts
    9,796
    Write a function (that works) which takes a string as its argument and reverses the words. So if the function were passed

    "This is a string"

    The resulting output from calling the function would be

    "string a is This"

    You can treat puntuation as part of a word. The declaration of the function is

    int reverseWords ( char *a );

    Be sure to make your function elegant, robust, and foolproof.

    -Prelude
    My best code is written with the delete key.

  3. #3
    Unregistered
    Guest

    Puchuk Puchuk

    He musta got scared

    hoooooooowaaah

  4. #4
    Registered User
    Join Date
    Jul 2002
    Posts
    15
    You can help me with my inventory program if you're really bored.

  5. #5
    Registered User moonwalker's Avatar
    Join Date
    Jul 2002
    Posts
    282

    hmm

    Inventory....

    hmm, by the way... how do you guys use the database in inventory programs ? Just curious..

    moreover, I see banks/hotels/shops using these programs in DOS!!!! even Airline people!!! why is that ??
    I am also curious how they make that blue colored GUI in DOS programs

  6. #6
    Registered User
    Join Date
    Jul 2002
    Posts
    7
    thanks Prelude. I actually did the program example, contrast to what the Unregistered may think. :P It didn't exactly turn out the way you gave the output though... Instead, what I got was:

    "This is a string"
    "gnirts a si sihT"

    :-) Though, you didn't include in your requirements to make the sentense come from the user. I did that, so I think it balanced both ways. :-) I wouldn't mind knowing how to reverse the word order though... I obviously can only reverse the character order.

    aprilbiz: lol. weird too, I just learned structures a few mins ago. You have anything you need help with specifically? I maybe a newbie at C programming, but I have good Programming Theory.

  7. #7
    Registered User
    Join Date
    Jul 2002
    Posts
    15
    Well since you asked..... *grinning from ear to ear*

    I've got to create an inventory program with three parts. Part one is to update 10 inventory items. Part two is for recording each sale, but before each sale, I have to check that there is enough of the item in stock. I am to sell what is available. If the item is out of stock I have to send a message to the screen stating this. Part three is to generate a weekly report of all transactions.

    Now, I'm just getting started with this so I don't have any code yet. I've been working on my other two problems that I already posted. This project is an open book project so I'm allowed to get as much help as possible. Feel free to give me ideas on this. You can private message me, email me, or post everything here for the benefit of others. I want to keep everything as simple as possible though.

  8. #8
    Registered User
    Join Date
    Jul 2002
    Posts
    7
    I have some suggestions running through my mind. Regardless of whether or not they were your intentions, I'm really stateing these for my benifit. (lol, aka, if I am on the right thinking track here...)

    Seems like you should divide it up in parts like you have done, but each part is a group of source files. I think stage 1 and 3 could get away with just one source file each. Stage 2 however, I think should be broken up into at least 2 source files. 1 containing the inventory of all items and their quantity. Then the other checking this inventory to see if it has the amount like you said. Actually, your inventory could probably be written to a external file that can be edited without ever opening the program. (aka, .txt file)

    Um... right... okay, I just lost myself. Hah... Weird, I rarely do that, but I'm getting this odd feeling. That I'm not talking too much worth while. So anyway, are you able to do this whole project by yourself? (aka, if I do help you, you'd be able to tell me what is right, what is wrong, and if I get stuck on a tiny part, you'd be able to get me out of it? Trust me, it won't be that much work for you, lol. I'm a fast learner, and I won't bother you unless I'm absolutely stuck. lol)

  9. #9
    Registered User
    Join Date
    Jul 2002
    Posts
    15

    Smile

    I've just been at this for 5 weeks or less, and I've had to split my study time between 2 other classes, so I don't know too much. Send me an email at aprilbiz@hotmail.com if you'd like to share any of your ideas, then when it's ready I'll bring it to the board with questions if any. Thanks!!!!!!!

  10. #10
    Code Goddess Prelude's Avatar
    Join Date
    Sep 2001
    Posts
    9,796
    >"gnirts a si sihT"
    That's only half of the solution. You reversed the characters in the string, not the words. Keep working at it and you'll come up with something. It's harder than it seems at first glance, but advanced string handling in C is a common series of interview questions, so you would do well to have at least a vague understanding of the subject.

    -Prelude
    My best code is written with the delete key.

  11. #11
    Registered User
    Join Date
    Jul 2002
    Posts
    15

    Smile

    oopps

  12. #12
    Registered User moonwalker's Avatar
    Join Date
    Jul 2002
    Posts
    282

    How do i do it ?

    I came up with this so far...
    Code:
    #include <stdio.h>
    #include <string.h>
    
    main()
    {
    	char *ptr1 = "This is a string";
    	char *ptr2 = "";
    	int *temp;
    
    	int i, j, k=0;
    
    	for (i= strlen(ptr1)-1; i>=0; i--)
    	{
    		if ( *(ptr1+i) == ' ')
    		{
    			*(temp + k) = i;
    			k++;
    		}
    	}
    
    }
    This will copy all the the places in *ptr1 where there
    are spaces into an array *temp.

    I understand what I should do next but I am not able
    to write a code... anyone ??

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Project ideas.
    By Wraithan in forum A Brief History of Cprogramming.com
    Replies: 5
    Last Post: 04-25-2009, 03:29 PM
  2. Ideas, how do you get them? xD
    By Akkernight in forum A Brief History of Cprogramming.com
    Replies: 10
    Last Post: 01-22-2009, 02:53 AM
  3. cool ideas for a game
    By Shadow12345 in forum Game Programming
    Replies: 7
    Last Post: 05-18-2004, 08:37 PM
  4. idea's idea's idea's
    By mithrandir in forum A Brief History of Cprogramming.com
    Replies: 10
    Last Post: 04-29-2002, 12:30 AM
  5. Small app ideas
    By dirkduck in forum A Brief History of Cprogramming.com
    Replies: 4
    Last Post: 02-15-2002, 07:57 PM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21