Need a unique gift idea?
A Pastebin account makes a great Christmas gift
SHARE
TWEET

Untitled

a guest Feb 25th, 2018 66 Never
Upgrade to PRO!
ENDING IN00days00hours00mins00secs
 
  1. //C2205h
  2. //13431/1
  3. //halyapin
  4. //24.02.18
  5.  
  6. #include <stdio.h>
  7. #include <stdlib.h>
  8. #define _CRT_SECURE_NO_WARNINGS
  9. #include <malloc.h>
  10.  
  11. int main()
  12. {
  13.     printf("C2205h\n");
  14.     printf("13431/1\n");
  15.     printf("halyapin\n");
  16.     printf("24.02.18\n");
  17.     printf("\n");
  18.  
  19.     int i1, Num1 = 0, Num2 = 0, temp = 0, i2, n, *iVec = NULL;
  20.     int *iCheck = NULL, i, iScan;
  21.     FILE* inf;
  22.  
  23.     inf = fopen("input2205h.txt","rt");
  24.     if (inf == NULL)
  25.     {
  26.         printf("file \"input2205h.txt\" doesnt  exist");
  27.         return 1;
  28.     }
  29.  
  30.     do
  31.     {
  32.         iScan = fscanf(inf, "%i", &temp);
  33.         if (iScan != EOF)
  34.         {
  35.             iVec = (int*)realloc(iVec, (Num1 + 1) * sizeof(int));
  36.             iVec[Num1] = temp;
  37.             Num1++;
  38.         }
  39.     } while (iScan != EOF);
  40.  
  41.     for (i = 0; i < Num1; i++)
  42.         printf("%i ", iVec[i]);
  43.  
  44.  
  45.     for (i1 = 0; i1 < Num1; i1++)
  46.     {
  47.         temp = 1;
  48.  
  49.         for (i2 = 0; i2 < Num2; i2++)
  50.             if (iVec[i1] == iCheck[i2])
  51.             {
  52.                 temp = 0;
  53.                 break;
  54.             }
  55.  
  56.         if (temp == 1)
  57.         {
  58.             iCheck = (int*)realloc(iCheck, (Num2 + 1) * sizeof(int));
  59.             iCheck[Num2] = iVec[i1];
  60.             Num2++;
  61.         }
  62.     }
  63.  
  64.     printf("\n%i", Num2);
  65.  
  66.     return 0;
  67. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top