Advertisement
Guest User

Untitled

a guest
Dec 20th, 2014
140
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 <iomanip>
  3. using namespace std;
  4. int main()
  5. {
  6. float n, a, x, d, z;
  7. setlocale(0, "");
  8. cout << "Ââåäèòå êîëëè÷åñòâî âû÷èñëåíèé : \n";
  9. cin >> n;
  10. if (n < 0){
  11. n = -n;
  12. a = 1.5;
  13. x = -0.7;
  14. d = a / 5;
  15. }
  16.  
  17. else {
  18. cout << "\nÂâåäèòå A : ";
  19. cin >> a;
  20. cout << "\nÂâåäèòå íà÷àëî ïîçèöèè Õ1 : ";
  21. cin >> x;
  22. cout << "\nÂâåäèòå øàã dX : ";
  23. cin >> d;
  24. }
  25. //cin>>a>>x>>d;
  26. cout << "\n\n";
  27. cout.width(2);
  28. cout<<"N";
  29. cout.width(6);
  30. cout<<"X";
  31. cout.width(8);
  32. cout<< "Y" << "\n\n";
  33.  
  34. for (int i = 0; i< n;i++){
  35. z = -z;
  36. cout.width(2);
  37. cout<< (i + 1);
  38. cout.width(6);
  39. cout<<x;
  40. cout.width(8);
  41. cout<< z << "\n";
  42. x = x + d;
  43. }
  44.  
  45. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement