Advertisement
DMG

Fontovi BHOI

DMG
Apr 22nd, 2013
74
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.74 KB | None | 0 0
  1. #include <iostream>
  2. #include <fstream>
  3. using namespace std;
  4.  
  5. string s;
  6. int vs[30], ms[30];
  7.  
  8. int main()
  9. {  
  10.     ifstream fin;
  11.     fin.open("ulaz.txt");
  12.     ofstream fout;
  13.     fout.open("izlaz.txt");
  14.    
  15.     long long a = 0;
  16.    
  17.     getline(fin, s);
  18.    
  19.     for (int i=0; i<26; i++)
  20.         fin >> vs[i];
  21.        
  22.     for (int i=0; i<26; i++)
  23.         fin >> ms[i];
  24.        
  25.     for (int i=0; i<s.length(); i++)
  26.         if (s[i]==' ')
  27.            a = a + 3;
  28.         else if (s[i]>65 && s[i]<91)
  29.            a = a + vs[s[i]-65];
  30.         else if (s[i]>96 && s[i]<123)
  31.            a = a + ms[s[i]-96];
  32.            
  33.    
  34.     a = a + s.length() - 1;
  35.    
  36.     fout << a << endl;
  37.            
  38.     // system("PAUSE");
  39.     return 0;
  40. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement