Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- /* run this program using the console pauser or add your own getch, system("pause") or input loop */
- using namespace std;
- class abstract{
- public:
- };
- class Fstala:public abstract{
- public:
- int a;
- void wyswietl wartosc()
- {
- cout<<"x"<<endl;
- }
- };
- class Fliniowa:public abstract{
- public:
- int a;
- int b;
- void wyswietl wartosc()
- {
- cout<<"y"<<endl;
- }
- };
- class Fkwadratowa:public abstract{
- public:
- int a;
- int b;
- int c;
- void wyswietl wartosc()
- {
- cout<<"k"<<endl;
- }
- };
- int main(int argc, char** argv) {
- int funkcja;
- abstract **tab = new abstract*[5];
- cout <<"podaj 6 roznych funkcji " <<endl;
- for(int i = 0;i<6;i++)
- {
- cout <<"1. stala " << endl;
- cout <<"2. liniowa " << endl;
- cout <<"3. kwadratowa " << endl;
- cin >> funkcja;
- switch(funkcja){
- case 1: tab[i] = new Fstala;
- case 2: tab[i] = new Fliniowa;
- case 3: tab[i] = new Fkwadratowa;
- }
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement