Welcome! Log In Create A New Profile



Posted by happy4u 
Announcements Last Post
Announcement SoC Curricula 09/30/2017 01:08PM
Announcement Demarcation or scoping of examinations and assessment 02/13/2017 07:59AM
Announcement School of Computing Short Learning Programmes 11/24/2014 08:37AM
Announcement Unisa contact information 07/28/2011 01:28PM
February 12, 2009 08:36AM
Language: C++
#include <iostream>   using namespace std;   int main ()   { float a,b,c; float average;   cout << "Please enter the first number : "; cin >> a; cout << "Please enter the second number : "; cin >> b; cout << "Please enter the third number : "; cin >> c;   average = (a + b + c) / 3;   cout << "The average of " << a << ", " << b << " and " << c << " is " << average << endl;   return 0; }
avatar Re: KKK
February 12, 2009 08:42AM
And your question is ?? confused smiley
February 16, 2009 11:23PM
Hi Wiseguy,

Assuming that I am not incorrect, the compiler will not know what to do with

cout << "The average of " << a << ", " << b <<
" and " << c << " is " << average << endl;

becaue either the cout line is missing a '; " on the end, which would then imply that the next line is missing a whole bunch of syntax aswell, OR

The "4th icon" that being quote has a limited amount of width (which I doubt).

So Happy 4 U, as my man WiseGuy states, what exactly is the problem other than what I have mentioned?
avatar Re: KKK
February 17, 2009 08:39AM
@Ruig ... if you copy, paste and run the code you'll find out that it runs without any compile errors.
The reason for this is that the "<<" in the first line tell the compiler to still expect something from the stream which causes the next line to be read in the stream.
Nothing fancy !!thumbs up smiley
avatar Re: KKK
February 17, 2009 08:58AM
Perhaps haapy4u was just testing the "add formatted code" button....
avatar Re: KKK
February 17, 2009 09:03AM
I thought so too !! smiling bouncing smiley
March 02, 2009 07:12PM
true, but I am sure that you will agree with me, that as far as formatting and good parctive, well it just isn't is it?spinning smiley sticking its tongue out
avatar Re: KKK
March 03, 2009 10:17AM
Yip !thumbs up
avatar Re: KKK
March 06, 2009 03:51PM
Didn't understand a word...
Sorry, only registered users may post in this forum.

Click here to login