In relation to another post, I did enroll in the Game Institute.   http://www.gameinstitute.com/

Thanx for the input Thanx for the help "lAmoebal".  It actually is helping more then when I was following along with other tutorials I have tried. Maybe it 's the structure. I still find C++ difficult. for example.

An excersise asks me to write a program that has a user entering five numbers. Then , average thse numbers, and display the result. So, far. So, good. 
But, when the numbers are displayed, ther are grouped together. How do I space the numbers out in the display. [B]Please, give me hints or clues. Or point me in the right direction. TY[/B]


#include <iostream>

using namespace std;

int main()
{
	//Declare variables
	float a, b, c, d, e;

	cout  << "Please enter a number: ";
	cin  >> a ;
	cout  << "Please enter a number: ";
	cin  >> b ;
    cout  << "Please enter a number: ";
	cin  >> c ;
	cout  << "Please enter a number: ";
	cin  >> d ;
    cout  << "Please enter a number: ";
	cin  >> e ;


	cout << "The average of: " << a << b << c << d << e <<" = " << (a+b+c+d+e)/5 <<endl <<endl <<endl;
		
		
		
}

Recommended Answers

All 3 Replies

just put a space between each one cout << The average of: " << a << " " << b << " " << c << d << " " << e << " "<<" = "

Thanx Ancient. A small hint would have sufficed. (c bold type). You know all.

Now, how can I wrap the code: i.e
cout << "The average of: " << a << " " << b << " " << c << " " << d << " " << e <<" = " << (a+b+c+d+e)/5 <<endl <<endl <<endl;

so it doesn't span across the whole page????

just put C/R in several places. The compiler doesn't care where they are.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.