Advertisement
edems96

Prog1 3. kisZH GPS

Oct 12th, 2015
131
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.53 KB | None | 0 0
  1. #include <stdio.h>
  2. #include <math.h>
  3.  
  4. struct Point {
  5.     double x, y;
  6. };
  7.  
  8. void GPS_Print(Point p) {
  9.     printf("%f %f\n", p.x, p.y);
  10. }
  11.  
  12. int GPS_IsNorth(Point p) {
  13.     return p.y > 0 ? 1 : 0;
  14. }
  15.  
  16. int GPS_East(Point p) {
  17.     return p.x > 0 ? 1 : 0;
  18. }
  19.  
  20. Point GPS_Read() {
  21.     Point p;
  22.     scanf("%lf %lf", &p.x, &p.y);
  23.    
  24.     return p;
  25. }
  26.  
  27. int main(void) {
  28.     Point p = GPS_Read();
  29.    
  30.     GPS_Print(p);
  31.    
  32.     printf("A(z) %s es a %s felteken van.",
  33.         GPS_IsNorth(p) ? "eszaki" : "deli",
  34.         GPS_East(p) ? "keleti" : "nyugati");
  35.    
  36.     return 0;
  37. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement