我是编程的第一年学生,我需要一些帮助.我有公共类的代码,但我需要将公共更改为私有.它对我不起作用.也许有人可以帮我提一些建议?这是我使用公共对象的工作代码,但我需要私有.我怎样才能做到这一点?
这是我班级的档案:
Klientas.h:
#include <iostream>
#include <fstream>
#include <string>
#include <cmath>
#include <iomanip>
using namespace std;
class Klientas
{
public:
string vardas;
double lesos;
};
#include <iostream>
#include <fstream>
#include <string>
#include <cmath>
#include <iomanip>
using namespace std;
Run Code Online (Sandbox Code Playgroud)
Klipas.h:
class Klipas
{
public:
string produktas;
string grupe;
double trukme;
double krastine1;
double krastine2;
double plotas;
double klipoSekKaina;
double klipoKaina;
};
Run Code Online (Sandbox Code Playgroud)
我的代码: Lab_1.cpp
#include "Klipas.h"
#include "Klientas.h"
using namespace std;
//---------------------------------------------
int main() {
setlocale(LC_ALL, "Lithuanian");
Klipas K[100];
int na;
Klientas …Run Code Online (Sandbox Code Playgroud)