UnluckyThom

Untitled

Nov 29th, 2021 (edited)
438
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 2.13 KB | None | 0 0
  1. #define RESET   "\033[0m"
  2. #define BLACK   "\033[30m"  /* Black */
  3. #define RED     "\033[31m"  /* Red */
  4. #define GREEN   "\033[32m"  /* Green */
  5. #define YELLOW  "\033[33m"  /* Yellow */
  6. #define BLUE    "\033[34m"  /* Blue */
  7. #define MAGENTA "\033[35m"  /* Magenta */
  8. #define CYAN    "\033[36m"  /* Cyan */
  9. #define WHITE   "\033[37m"  /* White */
  10. #define BOLDBLACK   "\033[1m\033[30m"   /* Bold Black */
  11. #define BOLDRED     "\033[1m\033[31m"   /* Bold Red */
  12. #define BOLDGREEN   "\033[1m\033[32m"   /* Bold Green */
  13. #define BOLDYELLOW  "\033[1m\033[33m"   /* Bold Yellow */
  14. #define BOLDBLUE    "\033[1m\033[34m"   /* Bold Blue */
  15. #define BOLDMAGENTA "\033[1m\033[35m"   /* Bold Magenta */
  16. #define BOLDCYAN    "\033[1m\033[36m"   /* Bold Cyan */
  17. #define BOLDWHITE   "\033[1m\033[37m"   /* Bold White */
  18.  
  19.  
  20. #include <assert.h>
  21. #include <stdio.h>
  22. #include <iostream>
  23. #include <stdlib.h>
  24. using namespace std;
  25.  
  26.  
  27. int
  28. main ()
  29. {
  30.   int codice, i, j, r, l, temp;
  31.   int iterazioni = 0;
  32.   int giri = 0;
  33.   int k = 0;
  34.   int p = 0;
  35.  
  36.   FILE *faro = fopen ("faretti.txt", "r");
  37.  
  38.  
  39.   if (!faro)
  40.     {
  41.       printf ("Couldn't open/find the txt file");
  42.       exit (1);
  43.     }
  44.  
  45.   while (fscanf (faro, "%d", &l) != EOF)
  46.     {
  47.       iterazioni++;
  48.     }
  49.  
  50.  
  51.   int Array[600][1];
  52.  
  53.   giri = iterazioni / 2;
  54.   if (iterazioni%2!=0){
  55.       cout << RED << "Mancano delle coordinate" << RESET << endl;
  56.       return 0;
  57.   }
  58.  
  59.   for (int i = 0; i < giri; i++){
  60.      
  61.           cout << "------------------" << endl;
  62.           cout << RED << "Ciclo N# : " << i << RESET << endl;
  63.           for (int j = 0; j < 2; j++){
  64.              
  65.               fscanf (faro, "%d", &Array[i][j]);
  66.               fscanf (faro, "%d", &temp);
  67.               cout << "------------------" << endl;
  68.               cout << "Valore i : [ " << i << " ]" << endl;
  69.               cout << "Valore j : [ " << j << " ]" << endl;
  70.               cout << "------------------" << endl;
  71.               cout << GREEN << "Valore [" << i << "]" << "[" << j << "]: {" <<Array[i][j] << "}" << RESET << endl;
  72.               cout << CYAN << "Val Salvato: [" <<temp << "]" << RESET << endl;
  73.             }
  74.     }
  75.  
  76.   fclose (faro);
  77.   return 0;
  78. }
  79.  
Add Comment
Please, Sign In to add comment