Home » General Discussions » General Discussion » I Learn Some Basic C++!
Re: I Learn Some Basic C++! [message #392003 is a reply to message #391996] |
Tue, 23 June 2009 18:04 |
_SSnipe_
Messages: 4121 Registered: May 2007 Location: Riverside Southern Califo...
Karma:
|
General (4 Stars) |
|
|
nopol10 wrote on Tue, 23 June 2009 17:00 |
SSnipe wrote on Wed, 24 June 2009 06:48 | as i said im new and this basic stuff is all i know so far but im just guessing it but here cnc
#include "stdafx.h"
#include <iostream>
using namespace std;
int main() {
double a, b, c, d, e;
cout << "Enter numbers here to be added up (5 is the max) then multiplied by 100 ";
cin >> a;
cout << "Enter second digits: ";
cin >> b;
cout << "Enter third digits: ";
cin >> c;
cout << "Enter fourth digits ";
cin >> d;
cout << "Enter fifth digits: ";
cin >> e;
cout << "The Output Is: " << 100 * a + b + c + d + e;
return 0;
}
|
Order of operations, what happens here is that a is multiplied by 100 and then added together with b, c, d and e. What you need is to bracket up a+b+c+d+e.
cout << "The Output Is: " << 100 * (a + b + c + d + e);
|
OO so simple, so do you always got to put those variables in brackest when theres mroe then one? or always?
|
|
|
|
|
I Learn Some Basic C++!
|
|
|
Re: I Learn Some Basic C++!
|
|
|
Re: I Learn Some Basic C++!
By: ErroR on Tue, 23 June 2009 08:30
|
|
|
Re: I Learn Some Basic C++!
|
|
|
Re: I Learn Some Basic C++!
|
|
|
Re: I Learn Some Basic C++!
|
|
|
Re: I Learn Some Basic C++!
|
|
|
Re: I Learn Some Basic C++!
By: raven on Tue, 23 June 2009 12:39
|
|
|
Re: I Learn Some Basic C++!
|
|
|
Re: I Learn Some Basic C++!
By: reborn on Tue, 23 June 2009 12:45
|
|
|
Re: I Learn Some Basic C++!
|
|
|
Re: I Learn Some Basic C++!
|
|
|
Re: I Learn Some Basic C++!
By: nopol10 on Tue, 23 June 2009 17:00
|
|
|
Re: I Learn Some Basic C++!
|
|
|
Re: I Learn Some Basic C++!
By: Omar007 on Wed, 24 June 2009 00:51
|
|
|
Re: I Learn Some Basic C++!
By: jnz on Wed, 24 June 2009 10:00
|
|
|
Re: I Learn Some Basic C++!
|
|
|
Re: I Learn Some Basic C++!
|
|
|
Re: I Learn Some Basic C++!
By: jnz on Thu, 25 June 2009 16:14
|
|
|
Re: I Learn Some Basic C++!
|
|
|
Re: I Learn Some Basic C++!
By: raven on Tue, 23 June 2009 18:06
|
|
|
Re: I Learn Some Basic C++!
|
|
|
Re: I Learn Some Basic C++!
By: dr3w2 on Wed, 24 June 2009 21:52
|
|
|
Re: I Learn Some Basic C++!
|
|
|
Re: I Learn Some Basic C++!
By: jnz on Wed, 24 June 2009 23:35
|
|
|
Re: I Learn Some Basic C++!
|
|
|
Re: I Learn Some Basic C++!
|
|
|
Re: I Learn Some Basic C++!
By: cmatt42 on Fri, 26 June 2009 10:27
|
|
|
Re: I Learn Some Basic C++!
|
|
|
Re: I Learn Some Basic C++!
|
|
|
Re: I Learn Some Basic C++!
By: jnz on Sat, 27 June 2009 06:58
|
|
|
Re: I Learn Some Basic C++!
|
|
|
Re: I Learn Some Basic C++!
|
|
|
Re: I Learn Some Basic C++!
By: Omar007 on Sat, 27 June 2009 12:05
|
|
|
Re: I Learn Some Basic C++!
|
|
|
Re: I Learn Some Basic C++!
By: Doitle on Sat, 27 June 2009 20:11
|
|
|
Re: I Learn Some Basic C++!
By: raven on Sat, 27 June 2009 20:57
|
|
|
Re: I Learn Some Basic C++!
|
|
|
Re: I Learn Some Basic C++!
|
|
|
Re: I Learn Some Basic C++!
By: reborn on Tue, 07 July 2009 01:11
|
|
|
Re: I Learn Some Basic C++!
|
|
|
Re: I Learn Some Basic C++!
By: reborn on Sun, 02 August 2009 14:26
|
|
|
Re: I Learn Some Basic C++!
By: _SSnipe_ on Sun, 02 August 2009 14:35
|
Goto Forum:
Current Time: Mon Nov 25 06:16:33 MST 2024
Total time taken to generate the page: 0.01304 seconds
|