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
Click For Summary

Discussion Overview

The discussion revolves around seeking assistance with basic C++ programming concepts and sample code, particularly in preparation for a midterm exam. Participants are looking for resources and examples related to loops, control structures, and functions, as well as specific tasks like calculating averages from user input.

Discussion Character

  • Homework-related
  • Technical explanation
  • Exploratory

Main Points Raised

  • One participant requests sample code for basic loop tasks, including counting, summing, and finding maximum values.
  • Another participant asks for examples of different types of loop control, such as sentinel style, counted loops, and end of file (eof) handling.
  • A specific request is made for a function that reads marks from standard input and outputs the average of marks that are 10 or higher.
  • One participant expresses frustration over the lack of a textbook for the course, suggesting that this has made learning more difficult for many students.
  • A suggestion is made to refer to a C++ tutorial website for basic control structures, although it is noted that it may not directly answer the specific questions posed.
  • Another participant seeks help with counting characters inputted by the user and requests a simple C++ code example for this task.
  • A later reply suggests using the cctype library and a while loop to receive characters and increment a counter.

Areas of Agreement / Disagreement

Participants generally agree on the need for resources and examples to aid in learning C++, but there is no consensus on specific solutions or methods to address the requests made.

Contextual Notes

Some participants express uncertainty about the availability of resources and the effectiveness of the current teaching methods, highlighting a reliance on lecture notes without a textbook.

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 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.
 

Similar threads

  • · Replies 15 ·
Replies
15
Views
2K
  • · Replies 8 ·
Replies
8
Views
2K
  • · Replies 2 ·
Replies
2
Views
5K
  • · Replies 3 ·
Replies
3
Views
1K
  • · Replies 15 ·
Replies
15
Views
2K
  • · Replies 13 ·
Replies
13
Views
3K
  • · Replies 11 ·
Replies
11
Views
4K
  • · Replies 14 ·
Replies
14
Views
5K
  • · Replies 6 ·
Replies
6
Views
3K
  • · Replies 5 ·
Replies
5
Views
2K