Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file added ClassClient
Binary file not shown.
31 changes: 31 additions & 0 deletions ClassClient.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
#include <iostream>
#include <string>
#include "Clientinfo.h"
#include <vector>
using namespace std;

int main ()
{
vector <Clientinfo> Cinfo;
Clientinfo client;
string name;
int i, age;

for (int i = 0; i < 4; i++)
{
cout << "Enter name of client" << i+1 << ": ";
cin >> name;
client.setname(name);
cout << "Enter age of client " << i+1 << ": ";
cin >> age;
client.setage(age);
Cinfo.push_back(client);
}

for (int i = 0; i < 4; i++)
{
cout << "Client's " << i+1 << " name is " << Cinfo[i].getname();
cout << " and he/she is " << Cinfo[i].getage() << " years old." << endl;
}
return 0;
}
21 changes: 21 additions & 0 deletions Clientinfo.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
#include "Clientinfo.h"

void Clientinfo::setname (std::string clientname)
{
name = clientname;
}

std::string Clientinfo::getname ()
{
return name;
}

void Clientinfo::setage (int clientage)
{
age = clientage;
}

int Clientinfo::getage ()
{
return age;
}
21 changes: 21 additions & 0 deletions Clientinfo.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
#ifndef Client_H
#define Client_H
#include <iostream>
#include <string>

class Clientinfo
{
public:
void setname (std::string clientname);

std::string getname ();

void setage (int clientage);

int getage ();

private:
int age = 0;
std::string name;
};
#endif