Go Back   PCMech Forums > Help & Discussion > Web Design / Development

Need Some Help? Type Your Keywords Here:

Reply
 
LinkBack Thread Tools Search this Thread Rate Thread Display Modes
Old 10-30-2007, 02:54 AM   #1
Member (4 bit)
 
Join Date: Aug 2007
Posts: 9
c++: Questions regarding strings and cases

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:
Quote:
//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.
finalcloud13 is offline   Reply With Quote
Old 11-04-2007, 12:21 AM   #2
Moderator
Staff
Premium Member
 
Join Date: Aug 2003
Location: Richmond, VA
Posts: 7,835
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
__________________
"For today, goodbye. For tomorrow, good luck. And forever, Go Blue!"
University of Michigan President Mary Sue Coleman
kram 2.0 is offline   Reply With Quote
Reply

Bookmarks

Still Need Help? Type Your Keywords Here:


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is On
Trackbacks are On
Pingbacks are On
Refbacks are On



All times are GMT -5. The time now is 07:33 AM.
Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2012, vBulletin Solutions, Inc.
SEO by vBSEO 3.6.0 PL2