C++ Program to Load and Display Records of N Products Using Class (Inline Function)
In C++, a class can be used to store the details of multiple products. An array of objects allows us to create and manage records of N products. An inline member function can perform small operations, such as calculating profit or loss. C++ में Class का उपयोग करके अनेक Products का रिकॉर्ड स्टोर किया जा सकता है। Array of Objects की सहायता से हम N Products के रिकॉर्ड को इनपुट और प्रदर्शित कर सकते हैं। Inline Member Function का उपयोग Profit या Loss जैसी छोटी गणनाओं के लिए किया जा सकता है। C++ Program #include <iostream> #include <string> using namespace std; #define N 5 class Product { int pid; string pname; float costprice; float sellprice; // Inline member function void profitloss() { float pl = sellprice - costprice; if (pl > 0) { cout << "Profit = " << pl << endl; } else if (pl < 0) { cout << "Loss = " << -pl << e...