There's no such thing as a stupid question, but they're the easiest to answer.
JoinTour
Login
 
Tag Cloud
access audio avg avg 8 bios blue screen boot bsod computer connection cpu crash css dell desktop dma driver drivers dvd email error excel explorer firefox firefox 3 freeze gimp graphics hard drive hardware hijackthis hjt install internet internet explorer itunes keyboard laptop macro malware monitor motherboard network networking outlook outlook 2003 outlook 2007 outlook express pio problem problems router seo server slow sound sp3 spyware trojan usb video virtumonde virus vista vundo windows windows vista windows xp winxp wireless
Software Development
Search
Search in:
 
Advanced Search
Tech Support Guy Forums > Software & Hardware > Software Development >
C++ programming function


HELLO AND WELCOME! Before you can post your question, you'll have to register -- it's completely free! Click here to join today! We highly recommend that you print a copy of our Guide for New Members. Enjoy!

 
Thread Tools
bajan_elf's Avatar
Junior Member with 3 posts.
 
Join Date: Jun 2003
Location: Barbados
25-Jun-2003, 09:49 PM #1
C++ programming function
hey, I'm working on a skool assignment and i have this slight problem. I'm doing a C++ program with functions and it was working fine before, now i ran into a ditch. i've attached the file because the program is about 200 and somebody lines. i would really appreciate any suggestions and help that can come my way.

thanks
lisa

bajan_elf@hotmail.com
Attached Files
File Type: txt inventory.txt (7.7 KB, 51 views)
Shadow2531's Avatar
Distinguished Member with 2,629 posts.
 
Join Date: Apr 2001
25-Jun-2003, 10:48 PM #2
What compiler are you using and what OS are you developing for?

I am using mingw on Windows Server 2K3.

I had to get rid of the clrscr function and replace it with system("cls"). I think clrscr() is a borland only deal, but not sure.

system("cls") requires the stdlib.h

I also had to change void main() to main (void)


See the attachment.

That's how I had to have it to get it to compile.

I thought the menu wasn't working at first until I figured out that you have to enter in a Capital letter for the menu item you want. You might want to fix that so it can be lowercase too.

Hope that helps.
Attached Files
File Type: txt inventory.txt (7.8 KB, 59 views)
__________________
10 ? "a line as the unending horizon"
20 ? "a curve as the rolling hillside"
30 ? "a point as a distant bird"
40 ? "a ray as the rising sun"
run
bajan_elf's Avatar
Junior Member with 3 posts.
 
Join Date: Jun 2003
Location: Barbados
25-Jun-2003, 11:23 PM #3
I'm using Turbo C++ 3.0 and it's in a DOS window, my OS is Windows ME. My teacher said that you didn't have to put anything in the void main () brackets unless returning values or whatever.

Thanks for the suggestion about the menu letters, I had to fix that... I still have a few nicks, but I think I can work through them.

Thanks
Lisa
Shadow2531's Avatar
Distinguished Member with 2,629 posts.
 
Join Date: Apr 2001
26-Jun-2003, 01:41 AM #4
Ok, then that code I posted should do ok for you.

And yes, do what your teacher says.

What exactly is the problem with the program?

It won't compile or a certain function is working or working the way you want it to?
bajan_elf's Avatar
Junior Member with 3 posts.
 
Join Date: Jun 2003
Location: Barbados
26-Jun-2003, 05:54 AM #5
Well, I dunno, it was working fine before and now it's gone kaputz.... everytime I call the Add command from the menu, it's bringing up the title, and completetly skipping the for loop.

Another problem with the Add function was that I had to enter 'A' twice before it feel into the loop. I dunno if I had one too many clear screens.

And after I typed in a video title and pressed enter it would take me back to the main menu. If I pressed A again, it would fall into the loop and do twice.

Then when I listed the information, only the last two videos titles I entered would come up.
Shadow2531's Avatar
Distinguished Member with 2,629 posts.
 
Join Date: Apr 2001
07-Jul-2003, 12:23 AM #6
I was messing with the program a little bit. I don't know if you are still working on the program or not, but here's what I found.

When selecting add ffrom the menu, it wouldn't jump to the Add function.

I fixed that by making count = 0 instead of -1 in MAIN.

As far as the add function goes, here is how it works for me.

I select "A" for add.

It then loads the add function and asks for the title, then the want value, then the cost.

Then it tells me to press enter to return to the main menu.

Then if I choose "A" for add again, it will allow me to enter in 2 entries and then tell press to press enter to go back to the main menu.

If I select "A" for add again, it will allow me to enter three entries and and then tell me to press enter to go back to the menu.

and so on.

each time you use the add function, it allows you to enter in one more entry than the previous time.

Is that how you want it to work?

Also, the program will go nuts if you enter a character where an integer needs to be inputted.

The list function only displays the entries from the last time you use the add function.

STL among others at www.hardforum.com in the webmastering and programing forum will help also.
__________________
10 ? "a line as the unending horizon"
20 ? "a curve as the rolling hillside"
30 ? "a point as a distant bird"
40 ? "a ray as the rising sun"
run
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are Off
Refbacks are Off

You Are Using:
Server ID
Advertisements do not imply our endorsement of that product or service.
All times are GMT -4. The time now is 02:53 PM.
Copyright © 1996 - 2008 TechGuy, Inc. All rights reserved.
Powered by vBulletin, Copyright © 2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.1.0
Powered by Cermak Technologies, Inc.