Advertisement
Guest User

Untitled

a guest
May 5th, 2015
250
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.19 KB | None | 0 0
  1. #include <iostream>
  2.  
  3. /* run this program using the console pauser or add your own getch, system("pause") or input loop */
  4. using namespace std;
  5. class abstract{
  6. public:
  7.  
  8. };
  9. class Fstala:public abstract{
  10. public:
  11. int a;
  12. void wyswietl wartosc()
  13. {
  14. cout<<"x"<<endl;
  15. }
  16. };
  17. class Fliniowa:public abstract{
  18. public:
  19. int a;
  20. int b;
  21. void wyswietl wartosc()
  22. {
  23. cout<<"y"<<endl;
  24. }
  25. };
  26. class Fkwadratowa:public abstract{
  27. public:
  28. int a;
  29. int b;
  30. int c;
  31. void wyswietl wartosc()
  32. {
  33. cout<<"k"<<endl;
  34. }
  35. };
  36.  
  37.  
  38. int main(int argc, char** argv) {
  39. int funkcja;
  40. abstract **tab = new abstract*[5];
  41. cout <<"podaj 6 roznych funkcji " <<endl;
  42. for(int i = 0;i<6;i++)
  43. {
  44. cout <<"1. stala " << endl;
  45. cout <<"2. liniowa " << endl;
  46. cout <<"3. kwadratowa " << endl;
  47. cin >> funkcja;
  48. switch(funkcja){
  49. case 1: tab[i] = new Fstala;
  50. case 2: tab[i] = new Fliniowa;
  51. case 3: tab[i] = new Fkwadratowa;
  52. }
  53.  
  54.  
  55.  
  56. }
  57.  
  58.  
  59. return 0;
  60. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement