fork download
  1. #include <cstdlib>
  2. #include <iostream>
  3. #include <cmath>
  4. using namespace std;
  5.  
  6. struct Vect {
  7. double x,y;
  8.  
  9. void summ(c);
  10. };
  11.  
  12. void print(Vect c){
  13.  
  14. cout<<c.x<<","<<c.y<<endl;
  15.  
  16. }
  17. void summ( Vect c){
  18. Vect a,b,c;
  19.  
  20.  
  21. c.x=(a.x+b.x);
  22. c.y=(a.y+b.y);
  23. }
  24. int main(){
  25. //объявим переменные типа Vect
  26. Vect a,b,c;
  27. cout<<"введем координаты первого вектора"<<endl;
  28. cin>>a.x;
  29. cin>>a.y;
  30.  
  31. cout<<"введем координаты второго вектора"<<endl;
  32. cin>>b.x;
  33. cin>>b.y;
  34.  
  35. summ( c);
  36. print (c);
  37.  
  38. cout<<"|a+b|= "<<sqrt((a.x+b.x)*(a.x+b.x)+(a.y+b.y)*(a.y+b.y))<<endl;
  39.  
  40. cout<<"|a-b|= "<<sqrt((a.x-b.x)*(a.x-b.x)+(a.y-b.y)*(a.y-b.y))<<endl;
  41. cout<<"|a*3| "<< sqrt((a.x*3)*(a.x*3)+(a.y*3)*(a.y*3))<<endl;
  42.  
  43.  
  44.  
  45. return 0;
  46. }
Compilation error #stdin compilation error #stdout 0s 0KB
stdin
Standard input is empty
compilation info
prog.cpp:9:12: error: ‘c’ has not been declared
  void summ(c);
            ^
prog.cpp: In function ‘void summ(Vect)’:
prog.cpp:18:10: error: declaration of ‘Vect c’ shadows a parameter
 Vect a,b,c;
          ^
stdout
Standard output is empty