ZateRok
May 21st, 2023
51
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. // Почему этот код не проходит, а проходит какой то левый код???
  2. #include <iostream>
  3.  
  4. using namespace std;
  5.  
  6. int main() {
  7.     long double x, y, z;
  8.     cin >> x >> y >> z;
  9.     long double r = x + y;
  10.     if (r != z) {
  11.         cout << "Error. The sum of "s << x << " and "s << y << " is "s << r << endl;
  12.     }
  13. }
  14.  
  15.  
  16. // тот самый левый код.....................
  17.  
  18. #include <iostream>
  19.  
  20. using namespace std;
  21.  
  22. int main() {
  23.  
  24. int x,y,z,sum,w;
  25.  
  26. cin>>x>>y>>z;
  27. w=x+y;
  28. sum=z;
  29. if(x+y!=sum)
  30. {
  31. cout<<"Error. The sum of "<< x << " and "<< y << " is " << w <<endl;
  32. }
  33. else {
  34. cout<<"";
  35. }
  36. return 0;
  37. }
  38.  
  39.  
  40. // так... я понял почему не работало, я косякнул, с кем не бывает, но на эмуляторе все работало стабильно... хз чем не понравилось забивание через сайт
Advertisement
Add Comment
Please, Sign In to add comment