Notes![what is notes.io? What is notes.io?](/theme/images/whatisnotesio.png)
![]() ![]() Notes - notes.io |
#include <string>
#include <stdlib.h>
#include <stdio.h>
#include <time.h>
#include <vector>
using namespace std;
class Statek
{
private:
string nazwa;
int liczba_dzial;
float wyszkolenie_zalogi;
int wytrzymalosc_kadluba;
public:
Statek(const string &anazwa, int aliczba_dzial, float awyszkolenie_zalogi, int awytrzymalosc_kadluba):
nazwa(anazwa), liczba_dzial(aliczba_dzial), wyszkolenie_zalogi(awyszkolenie_zalogi), wytrzymalosc_kadluba(awytrzymalosc_kadluba) {}
string getnazwa()
{
return nazwa;
}
int getliczba_dzial()
{
return liczba_dzial;
}
float getwyszkolenie_zalogi()
{
return wyszkolenie_zalogi;
}
int getwytrzymalosc_kadluba()
{
return wytrzymalosc_kadluba;
}
virtual float silaOgnia() const
{
float sila;
sila=wyszkolenie_zalogi*liczba_dzial;
return sila;
}
void wyswietl() const
{
cout << klasaOkretu() << endl;
cout << nazwa << endl;
cout << liczba_dzial << endl;
cout << wyszkolenie_zalogi << endl;
cout << wytrzymalosc_kadluba << endl;
cout << "Sila ognia to: " << silaOgnia() << endl;
}
virtual string klasaOkretu() const
{
return "Statek";
}
};
class HMSRetribution : public Statek
{
private:
float get_zmeczenie_zalogi() const
{
return 0.75 + 0.25*((float)rand()/(float)RAND_MAX);
}
public:
HMSRetribution(const string &anazwa, float awyszkolenie_zalogi):
Statek(anazwa, 15, awyszkolenie_zalogi, 150) {}
virtual float silaOgnia()
{
float zmeczenie_zalogi=get_zmeczenie_zalogi();
float sila=getwyszkolenie_zalogi()*getliczba_dzial()*zmeczenie_zalogi;
return sila;
}
string klasaOkretu() const
{
return "HMSRetribution";
}
};
class BlackPearl : public Statek
{
private:
float get_ilosc_rumu() const
{
return (float)rand()/(float)RAND_MAX;
}
public:
BlackPearl(const string &anazwa, float awyszkolenie_zalogi):
Statek(anazwa, 12, awyszkolenie_zalogi, 160) {}
virtual float silaOgnia()
{
float ilosc_rumu=get_ilosc_rumu();
float sila=getwyszkolenie_zalogi()*getliczba_dzial()*ilosc_rumu;
return sila;
}
string klasaOkretu() const
{
return "BlackPearl";
}
};
int main()
{
srand( (unsigned)time( NULL ) );
vector<HMSRetribution> vecFlota1;
vecFlota1.push_back(HMSRetribution("shipHMSRetribution 1", 1));
vecFlota1.push_back(HMSRetribution("shipHMSRetribution 2", 2));
vecFlota1.push_back(HMSRetribution("shipHMSRetribution 3", 3));
vecFlota1.push_back(HMSRetribution("shipHMSRetribution 4", 4));
vecFlota1.push_back(HMSRetribution("shipHMSRetribution 5", 5));
vecFlota1.push_back(HMSRetribution("shipHMSRetribution 6", 6));
for(unsigned int i=0; i<vecFlota1.size(); i++)
vecFlota1[i].wyswietl();
vector<BlackPearl> vecFlota2;
vecFlota2.push_back(BlackPearl("BlackPearl 1", 1));
vecFlota2.push_back(BlackPearl("BlackPearl 2", 2));
vecFlota2.push_back(BlackPearl("BlackPearl 3", 3));
vecFlota2.push_back(BlackPearl("BlackPearl 4", 4));
vecFlota2.push_back(BlackPearl("BlackPearl 5", 5));
vecFlota2.push_back(BlackPearl("BlackPearl 6", 6));
for(unsigned int i=0; i<vecFlota2.size(); i++)
vecFlota2[i].wyswietl();
}
![]() |
Notes.io is a web-based application for taking notes. You can take your notes and share with others people. If you like taking long notes, notes.io is designed for you. To date, over 8,000,000,000 notes created and continuing...
With notes.io;
- * You can take a note from anywhere and any device with internet connection.
- * You can share the notes in social platforms (YouTube, Facebook, Twitter, instagram etc.).
- * You can quickly share your contents without website, blog and e-mail.
- * You don't need to create any Account to share a note. As you wish you can use quick, easy and best shortened notes with sms, websites, e-mail, or messaging services (WhatsApp, iMessage, Telegram, Signal).
- * Notes.io has fabulous infrastructure design for a short link and allows you to share the note as an easy and understandable link.
Fast: Notes.io is built for speed and performance. You can take a notes quickly and browse your archive.
Easy: Notes.io doesn’t require installation. Just write and share note!
Short: Notes.io’s url just 8 character. You’ll get shorten link of your note when you want to share. (Ex: notes.io/q )
Free: Notes.io works for 12 years and has been free since the day it was started.
You immediately create your first note and start sharing with the ones you wish. If you want to contact us, you can use the following communication channels;
Email: [email protected]
Twitter: http://twitter.com/notesio
Instagram: http://instagram.com/notes.io
Facebook: http://facebook.com/notesio
Regards;
Notes.io Team