Advertisement
GraionDilach

Untitled

Feb 13th, 2014
85
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 1.18 KB | None | 0 0
  1. // ZimmGy-1.cpp : Defines the entry point for the console application.
  2. //
  3.  
  4. //#include "stdafx.h"
  5. #include <iostream>
  6. //#include <cstdlib>
  7. //#include <cmath>
  8.  
  9. using namespace std;
  10.  
  11. double rect_area(double side_a)
  12. {
  13.     return pow(side_a,2);
  14.  
  15.     //return side_a*side_a;
  16. }
  17.  
  18. double point_rect_area(double* side_a)
  19. {
  20.     return pow(*side_a,2);
  21. }
  22.  
  23. //int _tmain(int argc, _TCHAR* argv[])
  24. int main()
  25. {
  26.     std::cout << "Hello world" << std::endl;
  27.     cout << "Egyenes zérushelyének meghatározása:" <<  endl;
  28.     int a, b;
  29.     cout << "A:";
  30.     cin >> a;
  31.     cout << "B:";
  32.     cin >> b;
  33.     if (a)
  34.     {
  35.         double c = -1.0*b/a;
  36.         cout << "Eredmény: " << c << endl;
  37.     }
  38.     else
  39.     {
  40.         cout << "Nullával nem osztunk!" << endl;
  41.     }
  42.  
  43.     cout << "Négyzet területének számítása" <<  endl;
  44.     double a2;
  45.     cout << "Négyzet oldala:";
  46.     cin >> a2;
  47.     cout.precision(2);
  48.     cout << "Eredmény:" << rect_area(a2) << endl;
  49.     cout << "Eredmény:" << fixed << point_rect_area(&a2) << endl;
  50.     //cout.setf(ios::scientific);
  51.  
  52.     int* pt;
  53.     pt=&a;
  54.     printf("%d\n", a);
  55.     printf("%d\n", *pt);
  56.     printf("%p\n", pt);
  57.     printf("%p\n", &a);
  58.  
  59.     //printf("Hello world!");
  60.     //std::cin.get();
  61.     system("Pause");
  62.  
  63.     return 3256;
  64. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement