Guest User

Untitled

a guest
Sep 24th, 2018
90
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.32 KB | None | 0 0
  1. // Zakładam ze:
  2. // Istnieje funkcja potega(int a, int b) która zwraca (a^b)
  3.  
  4. int charToInt(const char* str, int strLen)
  5. {
  6.     int mnoznik = potega(10, strLen);
  7.     int i = 0;
  8.     int liczba;
  9.  
  10.     for (i = 0; i < strLen; i++)
  11.     {
  12.         char ascii = str[i];
  13.         liczba += (ascii-0x30) * mnoznik;
  14.         mnoznik /= 10;
  15.     }
  16.  
  17.     return liczba;
  18. }
Add Comment
Please, Sign In to add comment