a class
hello i have Question : if we enter 100 for "s" and 1 for "j" and 1 for "k" and 1 for "o" and 1 for "i" we must have p and a as p = 2 a =2 for output so why i get worng answer. try this code and see. thanks for help. //////////////////////////////////////////////////////////////////////////////////////////////////////////////// #include <iostream> using namespace std; class priceofcompany { public: void swelling() { cout << " Percentage of inflation next year " << endl; cin >> s; } void a4() { long int j, k; cout << " Price per packet of A4 paper " << endl; cin >> j; cout << " Number of packages produced " << endl; cin >> k; a = j*k; } void pencil() { long int o, i; cout << "The price of each pencil " << endl; cin >> o; cout << " The number of pencil productions " << endl; cin >> i; p = o*i; } void price() { p = p + p*s; a = a + a*s; cout << p << endl <<a; } private: double s, a, p; }; int main() { priceofcompany m, n, w, v; m.swelling(); n.a4(); w.pencil(); v.price(); cin.get(); cin.get(); return 0; }