1. Limited time only! Sign up for a free 30min personal tutor trial with Chegg Tutors
    Dismiss Notice
Dismiss Notice
Join Physics Forums Today!
The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

Homework Help: Need help with C++ samples. Basic intro stuff. Thanks

  1. Oct 21, 2011 #1
    1. The problem statement, all variables and given/known data

    I am getting ready for a midterm, and I got a list of stuff to study for the exam. Since I was put into the class late, I missed some intro stuff.

    Can some of you, whom probably know some good resources, give me a link or show me a sample code of the following: ?

    Basic loop task for 1) counting 2) summing 3) finding maximum

    Basic type of loop control: 1) sentinel style 2) counted 3) end of file (eof)

    Most important, which I cant find a sample code of:

    Write a function that returns..... given.....

    Is there any tutorials that can show a program that would read marks from standard input and output the average of the marks that are 10 or higher.

    Does not have to be that specific, but im not sure how to write that code. Any links or help with that one?

    2. Relevant equations

    3. The attempt at a solution
  2. jcsd
  3. Oct 22, 2011 #2


    Staff: Mentor

    Don't you have a textbook?
  4. Oct 22, 2011 #3
    NOPE! My prof decided not to use one. So, if you are lucky enough to be able to SCRAMBLE down huge chuncks of code during lecture, and are able to read his writing, you will be fine. But for 99% of the class, its kinda silly if you ask me. Lots of complaints.

  5. Oct 22, 2011 #4


    Staff: Mentor

    Maybe this will be helpful.
    It probably won't provide answers to your specific questions about inputting a list of scores, but it will help you with the basic control structures and such.
  6. Oct 22, 2011 #5
    Great sites, thanks!

    Mark or anyone else.... I cant seem to find a sample simple code in C++ that basically the user inputs some characters like sdf sdf sdf, and the program counts them, and cout's how many characters the user typed in?

    Any help?

    Thanks so much!
  7. Oct 23, 2011 #6

  8. Oct 24, 2011 #7
    Umm the best thing you can do is use the cctype library. Using a while loop, receive characters and increment the counter.
Share this great discussion with others via Reddit, Google+, Twitter, or Facebook