Witam chce zrobić coś takiego że w stringu będę miał gdzie wydalem pieniądze + ile wydałem + date + końcowy budzet. Ale tu pojawia się pewny problem zmienna ile wydałem (w programie to jest cost_of_purchasing) jest w metodzie z klasy i nie wiem jak się do niej dobrać?
main :
if ( choice == '1' )
{
std::cout << "Wybrales\aa zaplate przez gotowke" << std::endl;
std::cout << "Podaj date w ktorym zaplaciles\as gotowka" << std::endl;
day = day_payment.day();
month = month_payment.month();
year = year_payment.year();
date_final << day << "-" << month << "-" << year;
std::cout << date_final.str() << std::endl;
what_buy = buy.what_buying();
budget = cost.payment_cash( budget );
string_budget << budget;
string_cost <<
std::cout << "Teraz budzet wynosi: " << budget << std::endl;
purchase = what_buy + " " + date_final.str() + " " + string_budget.str();
std::cout << purchase << std::endl;
// file_final.add_informatio_to_file( purchase );
W ostatnim komentarzu próbowałem czegoś takiego.
transaction.cpp
double transactions::payment_cash( double b )
{
double cost_of_purchasing ;
std::cout << "ile zaplaciles\as: ";
std::cin >> cost_of_purchasing;
std::cout << "Tyle zaplaciles\as: " << cost_of_purchasing << std::endl;
std::cout << "ile wynosi b: " << b << std::endl;
b -= cost_of_purchasing;
return b;
}
transactions.h
#ifndef TRANSACTIONS_H
#define TRANSACTIONS_H
#include <string>
class transactions
{
public:
char selec_cash_card_or_payment();
double payment_cash( double b );
double payment_cash_to_card();
transactions();
};
#endif // TRANSACTIONS_H