Ok before i show you the code i'll explain what i want to do with it. I just want to multiply the variable quantity with balance to display the result(variable balance) when i'll call the Getfunction . I don't know how to declare it in my object because i can't write the variable within the objet's, i can only write numbers when i declare int.
-----------------------------------
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19
#include <iostream>
#include "Account class.h"
usingnamespace std;
int main()
{
CustomerAccount Item( 5, 1, amount,"marteau", "sa frappe" );
CustomerAccount Item2( 23536478, 777, amount,"Bardeau" ,"C cher en sale");
CustomerAccount Item3( 123, 3, amount, "Diaman", "nice deal" );
cout << "Nom: " << Item.getAccountName() << "\nPrix de l'item en question: " << Item.getAccountBalance() << "\nnombre: "<<Item.getAccountQuantity() << "\nLe montant total est : "<< Item.getAccountAmount() << "\nDescription: "<< Item.getAccountDescription() << endl;
cout << "Nom: " << Item2.getAccountName() << "\nPrix de l'item en question: " << Item2.getAccountBalance() << "\nnombre: "<<Item2.getAccountQuantity() << "\nLe montant total est : "<< Item.getAccountAmount() << "\nDescription: "<< Item2.getAccountDescription() << endl;
cout << "Nom: " << Item3.getAccountName() << "\nPrix de l'item en question: " << Item3.getAccountBalance() << "\nnombre: "<<Item3.getAccountQuantity() << "\nLe montant total est : "<< Item.getAccountAmount() << "\nDescription: "<< Item3.getAccountDescription() << endl;
}
I examined your post yesterday but couldn't figure out what the issue is.
I didn't find any question being asked. Questions typically end with a question mark (?).
Your statements lead me to think that the problem has something to do with how the value of amount is found.
One function looks a bit odd:
1 2 3 4 5
void CustomerAccount::setAccountAmount( int pAmount )
{
amount=quantity*balance;
amount=pAmount;
}
This assigns amount a value twice. Is this where the issue lies? <- ( note the ? mark )
Well, i answered my question myself. Look at the constructor. I had to use display message to get a int number to display and put the Cout in there too.