fork download
  1. #include "stdafx.h"
  2. #include <iostream>
  3. #include <stdio.h>
  4. #include <math.h>
  5. void main()
  6. { int i,j,pos1,pos2,k;
  7. float A[10],s;
  8. s=0;
  9. for(i=0;i<10;i++)
  10. {
  11. printf("Vvedite A[%i] = ",i);
  12. scanf("%f",&A[i]);
  13. }
  14.  
  15. i=0; k=0;
  16. while (k<=2)
  17. if ((A[i]<0)&&(k=0))
  18. {
  19. pos1=i; k++; i++;
  20. }
  21. else
  22. {
  23. pos2=i; k++; i++;
  24. }
  25. for(j=pos1;j<pos2;j++)
  26. s=s+A[j];
  27. setlocale(LC_ALL, "Russian");
  28. printf("Сумма = %f",s);
  29. }
  30. #include "stdafx.h"
  31. #include <iostream>
  32. #include <stdio.h>
  33. #include <math.h>
  34. void main()
  35. { int i,l,k;
  36. float A[10],s;
  37. s=0;
  38. for(i=0;i<10;i++)
  39. {
  40. printf("Vvedite A[%i] = ",i);
  41. scanf("%f",&A[i]);
  42. }
  43. i=0; k=0;
  44. while if(A[i]>0)
  45. i=i+1
  46. else
  47. k=i;
  48. while
  49. if(A[i]>0)
  50. i=i+1
  51. else l=i;
  52. for(i=1; i<k;i++)
  53. s=s+A[i];
  54. setlocale(LC_ALL, "Russian");
  55. printf("Сумма = %f",s);
  56. }
  57.  
Compilation error #stdin compilation error #stdout 0s 0KB
stdin
Standard input is empty
compilation info
prog.cpp:1:20: fatal error: stdafx.h: No such file or directory
compilation terminated.
stdout
Standard output is empty