Advertisement
Guest User

Untitled

a guest
May 5th, 2015
212
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.71 KB | None | 0 0
  1. #include <iostream>
  2. #include <string>
  3. #include <sstream>
  4. using namespace std;
  5.  
  6. struct point {
  7.   string name;
  8.   int x;
  9.   int y;
  10. } points [5];
  11.  
  12. void printPoint (point point);
  13.  
  14. int main ()
  15. {
  16.   string names;
  17.   int n;
  18.  
  19.   for (n=0; n<5; n++)
  20.   {
  21.     cout << "Podaj nazwe punktu: " << "\n";
  22.     getline (cin,points[n].name);
  23.     cout << "Podaj X" << "\n";
  24.     cin >> points[n].x;
  25.     cout << "Podaj Y" << "\n";
  26.     cin >> points[n].y;
  27.     getline (cin,names);
  28.   }
  29.  
  30.   cout << "\nWprowadziłeś następujące punkty :\n";
  31.   for (n=0; n<5; n++)
  32.     printPoint (points[n]);
  33.   return 0;
  34. }
  35.  
  36. void printPoint (point point)
  37. {
  38.   cout << point.name;
  39.   cout << " (X=" << point.x << ",Y= " << point.y << ")\n";
  40. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement