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

  • Thread starter Thread starter nukeman
  • Start date Start date
  • Tags Tags
    C++ Intro Thanks
AI Thread Summary
The discussion revolves around a student seeking help with basic C++ programming concepts in preparation for a midterm exam. Key topics include requests for sample code on loops for counting, summing, and finding maximum values, as well as different loop control types like sentinel and counted loops. The student specifically asks for guidance on writing a function to calculate the average of input marks that are 10 or higher. Participants suggest resources like C++ tutorials and provide basic coding advice, including using the cctype library for character counting. Overall, the conversation emphasizes the need for foundational programming support and accessible learning materials.
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.

:(
 
Maybe this will be helpful.
http://www.cplusplus.com/doc/tutorial/
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.
 
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 cout'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.
 

Similar threads

Replies
15
Views
2K
Replies
13
Views
3K
Replies
6
Views
3K
Replies
15
Views
2K
Replies
5
Views
2K
Replies
11
Views
3K
Replies
2
Views
1K
Back
Top