Thread: Program Looping Problem

  1. #16
    Anti-Poster
    Join Date
    Feb 2002
    Posts
    1,401
    The only thing that I noticed is that you didn't include any of the headers in the portion that you posted. After adding LuckY's includes, it worked compiled fine for me. Post a list of your errors.
    If I did your homework for you, then you might pass your class without learning how to write a program like this. Then you might graduate and get your degree without learning how to write a program like this. You might become a professional programmer without knowing how to write a program like this. Someday you might work on a project with me without knowing how to write a program like this. Then I would have to do you serious bodily harm. - Jack Klein

  2. #17
    Registered User
    Join Date
    Nov 2004
    Posts
    41

    Program Looping Problem

    The errors I get are as follows:

    Code:
    c:\dev-c_~1\examples\curren~1.cpp:663: `::ios_base' undeclared (first use here)
    c:\dev-c_~1\examples\curren~1.cpp:663: parse error before `::'
    c:\dev-c_~1\examples\curren~1.cpp: At top level:
    c:\dev-c_~1\examples\curren~1.cpp:686: ANSI C++ forbids declaration `USD_Menu' with no type
    c:\dev-c_~1\examples\curren~1.cpp:686: new declaration `int USD_Menu()'
    c:\dev-c_~1\examples\curren~1.cpp:55: ambiguates old declaration `void USD_Menu()'
    c:\dev-c_~1\examples\curren~1.cpp:687: parse error before `}'
    c:\dev-c_~1\examples\curren~1.cpp: In function `void USD_Menu()':
    c:\dev-c_~1\examples\curren~1.cpp:696: new declaration `void USD_Menu()'
    c:\dev-c_~1\examples\curren~1.cpp:686: ambiguates old declaration `int USD_Menu()'
    I tried adding my complete program source for you too, but I think due to its size, it does not want to be added to this post. I will try to add it in a separate message and see if that works.

  3. #18
    Registered User
    Join Date
    Nov 2004
    Posts
    41

    Program Looping Problem

    This didn't work, do you have any suggestions? Should I include the program as a *.zipped attachment? If I do send it that way, do I need the code tags for this file too?

  4. #19
    Anti-Poster
    Join Date
    Feb 2002
    Posts
    1,401
    Sure, add a zip file. It doesn't need code tags.
    If I did your homework for you, then you might pass your class without learning how to write a program like this. Then you might graduate and get your degree without learning how to write a program like this. You might become a professional programmer without knowing how to write a program like this. Someday you might work on a project with me without knowing how to write a program like this. Then I would have to do you serious bodily harm. - Jack Klein

  5. #20
    Registered User
    Join Date
    Nov 2004
    Posts
    41

    Program Looping Problem

    Here is a *zipped version of my program. I hope that this helps. Just as a reminder, I am using Dev-C++ version 4 as my compiler.

  6. #21
    and the hat of int overfl Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    39,660
    Why does this look like your previous question?
    http://cboard.cprogramming.com/showthread.php?t=59682

    A perfect illustration of how not to write code IMO.

    That being, you don't write hundreds of lines of code without pressing compile, then worry about whether it's too big or not to dump on a message board for someone else to figure out.

    Code:
    do {
      write_10_lines_of_code();
      while ( compiler_returns_errors() ) {
        fix_code_you_just_added();
      }
    } while ( program_not_finished() );
    The point being that if errors suddenly appear, you've got a pretty good idea that it's got something to do with the 10 lines you just added.

    > c:\dev-c_~1\examples\curren~1.cpp:663
    600+ lines huh?
    It's perfectly acceptable to create another project to test new ideas in to make sure you understand them fully, before trying to integrate them into your main project.
    At least then if it all goes wrong, you have something more manageable to post to the board.

  7. #22
    &TH of undefined behavior Fordy's Avatar
    Join Date
    Aug 2001
    Posts
    5,793
    AQWst

    Dont "throw your toys out of the pram" and send a moderator report for a response that you dont like. There's nothing "mean and nasty" about that reply, you should try to look at the response constructively and take in what's said.

  8. #23
    Anti-Poster
    Join Date
    Feb 2002
    Posts
    1,401
    Well, the only error is that somewhere around line 682, you have this:
    Code:
      }
      
      return 0;
    }
         USD_Menu();
    }
    That will compile if you change it to this:
    Code:
      }
      
      USD_Menu();
      return 0;
    }
    Looks like you forgot a bit when you pasted. I make no guarantees as to the logical operation of this program. Run it and tell us if there's any more problems.

    You might consider breaking your code up into a few different source code files. For instance, putting each nation's menu into a different file would help, as well as putting all the conversion constants into a header file.
    Last edited by pianorain; 12-21-2004 at 10:15 AM.
    If I did your homework for you, then you might pass your class without learning how to write a program like this. Then you might graduate and get your degree without learning how to write a program like this. You might become a professional programmer without knowing how to write a program like this. Someday you might work on a project with me without knowing how to write a program like this. Then I would have to do you serious bodily harm. - Jack Klein

  9. #24
    It's full of stars adrianxw's Avatar
    Join Date
    Aug 2001
    Posts
    4,829
    I would echo Fordys point and would add that you are a new member. Telling us mods, who have been here for years what we do and don't need is "a trifle arrogant?"
    Wave upon wave of demented avengers march cheerfully out of obscurity unto the dream.

  10. #25
    Magically delicious LuckY's Avatar
    Join Date
    Oct 2001
    Posts
    856
    Aside from that error pianorain mentioned, there are no syntactic errors. I am not a user of DevC++ but since using ios::in worked and ios_base::in doesn't, I'd recommend giving the former a try over the latter.

    As an aside, your code could be streamlined considerably. You have the same blocks of code repeating throughout the entire file. Instead of having twenty-someought menus you could have a single menu that displays it's contents based on what current menu you are on (btw, your menus have too many rows to be displayed in a standard 80x25 screen).

  11. #26
    Registered User
    Join Date
    Nov 2004
    Posts
    41
    I have the program compile down to two errors now. They are:

    Code:
    c:\dev-c_~1\examples\curren~1.cpp:663: `::ios_base' undeclared (first use here)
    c:\dev-c_~1\examples\curren~1.cpp:663: parse error before `::'

  12. #27
    Registered User
    Join Date
    Nov 2004
    Posts
    41

    Program Looping Problem

    FYI, the program worked with all of the lines of code I added prior to adding the logic to read the *.csv file. This is the logic I added to hopefully remove the constants I have set up for each of the conversions.

  13. #28
    Magically delicious LuckY's Avatar
    Join Date
    Oct 2001
    Posts
    856
    See my previous post about that problem.

    I added a little bit to your code to demonstrate how you can simplify your code considerably. Keep in mind it is only a start. Use the principles I've employed to revise your entire program. Good luck.

    Here's the revised version. Just search for "lucky" to see where I made changes.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Replies: 4
    Last Post: 05-25-2008, 12:31 AM
  2. [NEED HELP] I just can't solve this program problem!
    By frodonet in forum C Programming
    Replies: 7
    Last Post: 09-23-2007, 02:44 PM
  3. Inheritance and Dynamic Memory Program Problem
    By goron350 in forum C++ Programming
    Replies: 1
    Last Post: 07-02-2005, 02:38 PM
  4. Looping Problem
    By ccmac in forum C++ Programming
    Replies: 1
    Last Post: 04-22-2002, 02:46 PM
  5. Console Program Problem
    By Breach23 in forum C++ Programming
    Replies: 3
    Last Post: 10-19-2001, 12:35 AM