Need help with C++ samples. Basic intro stuff. Thanks

  • Context: Comp Sci 
  • Thread starter Thread starter nukeman
  • Start date Start date
  • Tags Tags
    C++ Intro Thanks
Join the discussion
Ask a follow-up here, or get your own question answered by working scientists, mathematicians and engineers — people, not an autocomplete.
Real named experts · corrections over time · the nuance an AI answer skips
6 replies · 2K views
nukeman
Messages
651
Reaction score
0

Homework Statement



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 can't 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 I am not sure how to write that code. Any links or help with that one?


Homework Equations





The Attempt at a Solution

 
Physics news on Phys.org
nukeman said:

Homework Statement



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 can't 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 I am not sure how to write that code. Any links or help with that one?


Homework Equations





The Attempt at a Solution


Don't you have a textbook?
 
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.

:(
 
Great sites, thanks!

Mark or anyone else... I can't 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 count's how many characters the user typed in?

Any help?

Thanks so much!
 
Umm the best thing you can do is use the cctype library. Using a while loop, receive characters and increment the counter.