Advertisement
eimkasp

JKM Testas 10 var 2

Jan 21st, 2012
185
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.86 KB | None | 0 0
  1. #include <iostream>
  2. #include <fstream>
  3. #include <string.h>
  4. #include <string>
  5. #include <locale.h>
  6.  
  7. int numer();
  8.  
  9. using namespace std;
  10.  
  11.     char a[256];
  12.     char Eilutes[50][256];
  13.     string temp;
  14.     int eNR =0;
  15.     int sk = 0;
  16.     ifstream fd("Tekstas.txt");
  17.     ofstream fr("Rezultatai.txt");
  18.  
  19. int main() {
  20.     // 32 46 44
  21.     int sMax = INT_MIN;
  22.     setlocale(LC_ALL,"Lithuanian");
  23.    
  24.    
  25.    
  26.    
  27.  
  28.     while (!fd.eof()) {
  29.         eNR++;
  30.         fd.getline(a,256);
  31.         strcpy(Eilutes[eNR],a);
  32.         cout << Eilutes[eNR] << endl;
  33.     }
  34.  
  35.     numer();
  36.     cin >> eNR;
  37.     return 0;
  38. }
  39.  
  40. int numer () {
  41.         for (int i = 1; i <= eNR; i++) {
  42.         temp = Eilutes[i];
  43.         sk = 0;
  44.         for(int j = 0; j <= temp.size(); j++) {
  45.             if((int)temp[j] == 32 ||  (int)temp[j] == 46 || (int)temp[j] == 44){
  46.                 sk++;
  47.             }
  48.         }
  49.         fr << i << " eiluteje yra " << sk << " skyrikliu" << endl;
  50.         cout << sk << " ";
  51.     }
  52.  
  53. return 0;
  54. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement