Mortgages | Loans | Loans | Debt Consolidation | Agencia de turismo
c++: Questions regarding strings and cases [Archive] - PCMech Forums

PDA

View Full Version : c++: Questions regarding strings and cases


finalcloud13
10-30-2007, 03:54 AM
In my entry-level computer science course, the professor wants us to write a little program that will classify a message as spam or not. Some of the instructions that are giving me trouble are the following:

1. "Enter the body of the email. Press enter on an empty line to finish." I don't understand how to do this. To make myself clear here, I mean that the user has to press Enter on an empty line in order to finish writing the body part. Example:

//This is what I want, but don't have.
Hi mom. <-- the user is able to hit the Enter key on this line
<-- and again on this line to submit the body.

//This is what I have, but don't want.
Hi mom. <-- the user is only able to press Enter once before the program takes the input.

2. What do I do to check if a string has least one word, and more than 90% of the words in the subject line consist of only uppercase letters?

More questions to come soon :x Thanks in advance.

kram 2.0
11-04-2007, 01:21 AM
Firstly, can't you simply put an endline after the cout statement in order to start from the next line, when you cin?

Secondly, think ASCII. Each letter, upper case, lower case, etc., corresponds to a value. If the value of the letter in any string is above a certain number, then the letter is upper case.

kram