Jump to content
Hash, Inc. Forums
Sign in to follow this  
robcat2075

C++ Study Group Week 03

Recommended Posts

The next three chapters in John Purcell's series are brief and easy so we will do them together

07 - Strings. The "string" variable is introduced along with string "concatenation".

08 - User Input. This is a biggie! Using "cin" to get data while the program is running.

09 - Binary Numbers. I like that he doesn't just presume everyone would know this.

 

Assignment:

The project for 7 and 8 could be combined. It could be anything that demonstrates having the computer ask questions that you answer and then it assembles that information into some new form.

  • The old memes that would take your pet's name, the name of the street you grew up on, and something else, then lump those together to make something like your "Country Western singer" name.
  • Prompt the User to separately input name, address, city, state, and ZIP Code... then output those properly on three lines.
  • Prompt the User to input certain parts of speech (noun, verb, etc...) and insert those into a Mad Libs sentence.
  • Prompt the User to input three places and three verbs and output that in three sentences that combine a verb and a place.
  • Anything else you wish to dream up!

Something like that would be possible.

Lecture 9 is purely informational, no assignment.

 

Again, I'll suggest typing out exactly the example programs John Purcell does on-screen before you write your own.

 

Share this post


Link to post
Share on other sites

This is odd...

string.JPG

Share this post


Link to post
Share on other sites

I have added some more project ideas in the first post.

Share this post


Link to post
Share on other sites
On 5/17/2019 at 5:08 PM, robcat2075 said:

This is odd...

string.JPG

If you float your cursor over the error does it present a helper to give a hint on why? Also with variables it is good practice to preface the bar name with the bar type. For instance, a string var named address would be str_address. This makes it easier for some poor developer down the road to read your code.

Share this post


Link to post
Share on other sites

It's not doing it right now, but it would say

identifier "string" is undefined

And suggested adding

#include <string>

 

The program would still compile and run either way, which i also thought was odd.

Share this post


Link to post
Share on other sites

I will have to try and recreate that tomorrow evening. I would say it is odd behavior, but it's Microsoft so that would be a misnomer since odd behavior is pretty much the norm.

Share this post


Link to post
Share on other sites

I got it to come back, but on a different line. It happens when i delete a comment line I had at the red X and another later in the program.

If I wait awhile it will go away on its own.  It's a minor blip, you don't have to spend time on it.

But it is odd.

 

StringWarning.jpg

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Sign in to follow this  

×
×
  • Create New...