fork download
  1. // Это первая программа:
  2.  
  3. #include <stdio.h>
  4.  
  5. int main(void)
  6. {
  7. printf("Здравствуй, мир!\n");
  8. return 0;
  9. }
  10.  
  11. =========================================
  12.  
  13. // Эта программа осуществляет чтение целых чисел из
  14. // файла "input.txt", суммирует их и выводит результат
  15. // на экран
  16.  
  17. #include <stdio.h>
  18.  
  19. int main(void)
  20. {
  21. int a,sum=0;
  22. FILE *fin=NULL;
  23.  
  24. if( (fin=fopen("input.txt","r"))==NULL )
  25. { printf("файл input.txt не открылся\n"); return -1; }
  26.  
  27. while( fscanf(fin,"%d",&a)==1 ) sum+=a;
  28.  
  29. printf("sum=%d\n",sum);
  30. return 0;
  31. }
  32.  
  33.  
  34. #include <stdio.h>
  35.  
  36.  
  37. int main(){
  38. int max=0, a=0, aBuf=0, counter = 1;
  39.  
  40. FILE *fin=NULL;
  41. if ((fin=fopen("input.txt", "r"))==NULL)
  42. {
  43. printf("Файл не открывается\n"); return -1;
  44. }
  45. fscanf(fin, "%d", &aBuf);
  46.  
  47. while (fscanf(fin, "%d", &a)==1){
  48. if(a>aBuf){
  49. counter++;
  50. }
  51. else {
  52. if(counter>max)
  53. max=counter;
  54. counter=1;
  55. }
  56. aBuf=a;
  57. }
  58.  
  59. printf("%d", max);
  60.  
  61. return 0;
  62.  
  63.  
  64. }
  65.  
  66.  
  67.  
  68.  
Compilation error #stdin compilation error #stdout 0s 0KB
stdin
Standard input is empty
compilation info
prog.c:11:1: error: expected identifier or '(' before '==' token
 =========================================
 ^
prog.c:37:5: error: redefinition of 'main'
 int main(){
     ^
prog.c:5:5: note: previous definition of 'main' was here
 int main(void)
     ^
stdout
Standard output is empty