Go Back   RCCrawler.com Bulletin Board > Miscellaneous > Chit Chat

Notices


Thread: Anyone here know C++ programming? I have a question.

Reply
 
LinkBack Thread Tools Display Modes
Old 02-20-2009, 08:22 PM   #1
I wanna be Dave
 
Scattman's Avatar
 
Join Date: Dec 2005
Location: Hawthorne, Florida
Posts: 2,568
Default Anyone here know C++ programming? I have a question.

Have a question....trying to get a blank line where I have it listed in yellow. What am I missing. The program works fine, just can't get it spaced like I want.

//John ######
//COP1000.052
//This program calculates the sum, average, median, minimum and maximum of 3 input numbers.
#include
usingnamespace std;
int main()
{
float median;
float numberone;
float numbertwo;
float numberthree;
cout << "This program calculates the sum,average, median, minimum \n" ;
cout << "and maximum from 3 input numbers." << endl << endl;
cout << "Please input the first value: ";
cin >> numberone;
WOULD LIKE A BLANK LINE HERE
cout << "Please input the second value: ";
cin >> numbertwo;
WOULD LIKE A BLANK LINE HERE
cout << "Please input the third value: ";
cin >> numberthree;
WOULD LIKE A BLANK LINE HERE
cout << "The three input numbers entered are:" << numberone << ", " << numbertwo << ",and " << numberthree << endl << endl;
if ((numberone >= numbertwo && numberone <= numberthree) || (numberone >= numberthree && numberone <= numbertwo)) median = numberone;
elseif ((numbertwo >= numberone && numbertwo <= numberthree) || (numbertwo >= numberthree && numbertwo <= numberone)) median = numbertwo;
else median = numberthree;

cout << "The sum is:" << (numberone + numbertwo + numberthree) << endl << endl;
cout << "The average is:" <<((numberone + numbertwo +numberthree)/3) << endl << endl;
cout << "The maximum is:" << max(max(numberone, numbertwo), numberthree)<< endl << endl;
cout << "The median is:" << median << endl << endl;
cout << "The minimum is:" << min(min(numberone, numbertwo), numberthree)<< endl << endl << endl << endl;
cout << "Thank you for playing. \n" << endl << endl;
return 0;
}
Scattman is offline   Reply With Quote
Sponsored Links
Old 02-20-2009, 08:24 PM   #2
I wanna be Dave
 
Rockcrawler's Avatar
 
Join Date: Jan 2005
Location: Hueytown, Alabama
Posts: 6,796
Default

< p >


Rockcrawler is offline   Reply With Quote
Old 02-20-2009, 08:26 PM   #3
I wanna be Dave
 
Scattman's Avatar
 
Join Date: Dec 2005
Location: Hawthorne, Florida
Posts: 2,568
Default

Quote:
Originally Posted by Rockcrawler View Post
< p >


jackass
Scattman is offline   Reply With Quote
Old 02-20-2009, 08:31 PM   #4
I wanna be Dave
 
Rockcrawler's Avatar
 
Join Date: Jan 2005
Location: Hueytown, Alabama
Posts: 6,796
Default

Quote:
Originally Posted by Scattman View Post
jackass

Oh, thats HTML....never mind.
Rockcrawler is offline   Reply With Quote
Old 02-20-2009, 08:58 PM   #5
Wishing I was Crawling
 
ROSS's Avatar
 
Join Date: Feb 2007
Location: Missouri Boot-Heel
Posts: 756
Default

not 100% but try these.

cout <<'\n << \n'

cout <<'\\n << \\n'
ROSS is offline   Reply With Quote
Old 02-21-2009, 09:09 AM   #6
I wanna be Dave
 
binaryterror's Avatar
 
Join Date: Jan 2004
Location: Detroit
Posts: 2,328
Default

Quote:
Originally Posted by Scattman View Post
cout << "Please input the first value: \n";
cin >> numberone;
cout << "Please input the second value: \n";
cin >> numbertwo;
cout << "Please input the third value: \n";
cin >> numberthree;
Try the bolded additions
binaryterror is online now   Reply With Quote
Old 02-21-2009, 11:02 AM   #7
I wanna be Dave
 
Scattman's Avatar
 
Join Date: Dec 2005
Location: Hawthorne, Florida
Posts: 2,568
Default

Quote:
Originally Posted by binaryterror View Post
Try the bolded additions
I had already tried that but it didn't space like I wanted. It did this instead

Please enter first value
10
Please enter second value
20
Please enter third value
30


I was trying to get it to look like this

Please enter first value: 10

Please enter second value: 20

Please enter third value: 30



This is how it is as I have it written now...


Please enter first value:10
Please enter second value:20
Please enter third value:30
Scattman is offline   Reply With Quote
Old 02-21-2009, 07:19 PM   #8
I wanna be Dave
 
binaryterror's Avatar
 
Join Date: Jan 2004
Location: Detroit
Posts: 2,328
Default

Quote:
Originally Posted by Scattman View Post
cout << "Please input the first value: ";
cin >> numberone;
cout >> "\n"
cout << "Please input the second value: ";
cin >> numbertwo;
cout >> "\n"
cout << "Please input the third value: ";
cin >> numberthree;
cout >> "\n"
Have you tried this?
binaryterror is online now   Reply With Quote
Old 02-21-2009, 10:47 PM   #9
I wanna be Dave
 
Scattman's Avatar
 
Join Date: Dec 2005
Location: Hawthorne, Florida
Posts: 2,568
Default

Quote:
Originally Posted by binaryterror View Post
Have you tried this?
I just did and got a buttload of errors.
Scattman is offline   Reply With Quote
Reply


Thread Tools
Display Modes

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 -6. The time now is 02:56 PM.


Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2012, vBulletin Solutions, Inc.
Content Relevant URLs by vBSEO ©2011, Crawlability, Inc.
Copyright 2004-20010 RCCrawler.com