CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 7 of 7
  1. #1
    Join Date
    Sep 2014
    Posts
    15

    C++ Beginner Help

    Hello guys i need some quick assistance please
    I'm writing a code which goes as follows.
    the program will prompt the user to enter a every student's first and last name, major ( of 4 choices CMPS MATH PHYSICS or EECE ), and grade.
    it's agreed that the professor will enter the name NoMore to stop the entry.
    the program willl then store the info in a txt file. after closing the input file, the program will open it again read the records one at a time until end of file, and do some statistics including: highest grade, average grade, and highest average by major.
    Finally the program will print the results
    Now i need help anyway and if some could provide me with the Pseudo-code that would be awesome
    many thanks ^^

  2. #2
    2kaud's Avatar
    2kaud is offline Super Moderator Power Poster
    Join Date
    Dec 2012
    Location
    England
    Posts
    7,824

    Re: C++ Beginner Help

    Please see http://forums.codeguru.com/showthrea...ork-assignment

    What help do you want with your program? If you post the code you already have then we'll provide advice and guidance but nobody here is going to do the program for you - or even give you the Pseudo-code - as that would be considered cheating.

    However, to assist you with producing your program design, think about how you would do it using pen and paper and what steps would be needed to do this in a program - eg open file, input data, write data etc etc etc.Once you have the program design then you can produce the program code and test and debug it.

    Just a note about the program requirements. If the sole reason for storing the info in a text file is to read the records to produce statistics from the data then there is no need to use a file. This can all be done quite easily as part of the processing for each set of entered data.
    All advice is offered in good faith only. All my code is tested (unless stated explicitly otherwise) with the latest version of Microsoft Visual Studio (using the supported features of the latest standard) and is offered as examples only - not as production quality. I cannot offer advice regarding any other c/c++ compiler/IDE or incompatibilities with VS. You are ultimately responsible for the effects of your programs and the integrity of the machines they run on. Anything I post, code snippets, advice, etc is licensed as Public Domain https://creativecommons.org/publicdomain/zero/1.0/ and can be used without reference or acknowledgement. Also note that I only provide advice and guidance via the forums - and not via private messages!

    C++23 Compiler: Microsoft VS2022 (17.6.5)

  3. #3
    Join Date
    Jun 2002
    Location
    Stockholm, Sweden
    Posts
    1,641

    Re: C++ Beginner Help

    +1 to what Kaud said. When we say "cheating", we mostly refer to that you would be fooling yourself into believing that you actually learnt something, when you in fact did not.
    Nobody cares how it works as long as it works

  4. #4
    2kaud's Avatar
    2kaud is offline Super Moderator Power Poster
    Join Date
    Dec 2012
    Location
    England
    Posts
    7,824

    Re: C++ Beginner Help

    Quote Originally Posted by zerver View Post
    +1 to what Kaud said. When we say "cheating", we mostly refer to that you would be fooling yourself into believing that you actually learnt something, when you in fact did not.
    ...and potentially passing off someones else's work as your own - which IMO is more serious.
    All advice is offered in good faith only. All my code is tested (unless stated explicitly otherwise) with the latest version of Microsoft Visual Studio (using the supported features of the latest standard) and is offered as examples only - not as production quality. I cannot offer advice regarding any other c/c++ compiler/IDE or incompatibilities with VS. You are ultimately responsible for the effects of your programs and the integrity of the machines they run on. Anything I post, code snippets, advice, etc is licensed as Public Domain https://creativecommons.org/publicdomain/zero/1.0/ and can be used without reference or acknowledgement. Also note that I only provide advice and guidance via the forums - and not via private messages!

    C++23 Compiler: Microsoft VS2022 (17.6.5)

  5. #5
    Join Date
    Sep 2014
    Posts
    15

    Re: C++ Beginner Help

    okay guys sorry about that
    I now know how to do it i just have 1 question
    how can i keep telling the user to input names,majors,and grades then when the user types noMore as a name , i stop the input then move on ?

  6. #6
    Join Date
    Jun 2002
    Location
    Stockholm, Sweden
    Posts
    1,641

    Re: C++ Beginner Help

    Hi there.

    In most programming languages repeated actions are accomplished using loops. The loops are possible to exit based on a condition. I suggest you Google for "C++ loops"...

    Regards
    Nobody cares how it works as long as it works

  7. #7
    2kaud's Avatar
    2kaud is offline Super Moderator Power Poster
    Join Date
    Dec 2012
    Location
    England
    Posts
    7,824

    Re: C++ Beginner Help

    In c++ there are several ways of implementing a loop - for, while and do...while. See http://www.learncpp.com/cpp-tutorial...-introduction/ and subsequent links.

    A basic structure of something like this is (there are several ways this can be coded)
    Code:
    do
       get data
       if data_is_good 
           process data
    while (data_is_good)
    the data_is_good test would be checking if name entered was noMore.

    If you post your code we'll provide further advice and guidance.

    Good luck!
    All advice is offered in good faith only. All my code is tested (unless stated explicitly otherwise) with the latest version of Microsoft Visual Studio (using the supported features of the latest standard) and is offered as examples only - not as production quality. I cannot offer advice regarding any other c/c++ compiler/IDE or incompatibilities with VS. You are ultimately responsible for the effects of your programs and the integrity of the machines they run on. Anything I post, code snippets, advice, etc is licensed as Public Domain https://creativecommons.org/publicdomain/zero/1.0/ and can be used without reference or acknowledgement. Also note that I only provide advice and guidance via the forums - and not via private messages!

    C++23 Compiler: Microsoft VS2022 (17.6.5)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured