Kashub's Code Barn - "Julka"

podświetlone jako ocaml (dodał(a) Julka @ 2021-01-09 16:12:16)

Twoja wyszukiwarka
Podświetl ten kod w:
Ostatnio dodane:
Losowe wpisy:
 
#include <iostream>
#include <sstream>
#include <vector>
 
 
using namespace std;
 
 
void findInStr(const vector<string>& ListaZnakow, int& increment, const string& strToSearch){
 
    for(const auto& znak : ListaZnakow){
 
         size_t pos = 0;
 
        while ((pos = strToSearch.find(znak,pos)) != string::npos){
            ++pos;
            ++increment;
         };
    }
 
}
 
 
int main()
{
    string s,tekst = "";
    int wiersze = 0;
    int slowa = 0;
    int ileZnakiBiale = 0;
    int ileZnakiCzarne = 0;
 
    const vector<string> znakiBiale = {" "};
    const vector<string> nowaLinia = {"\n"};
    const vector<string> znakiCzarne = {"<",">","[","]"};
 
 
    while(getline(cin,s),s!=""){
 
        tekst+=(s+"\n");
 
    }
 
    stringstream stekst(tekst);
 
    while(!stekst.eof()){
 
        string slowo;
        stekst >> slowo;
 
        ++slowa;
 
    }
 
    findInStr(znakiBiale,ileZnakiBiale,stekst.str());
    findInStr(nowaLinia,wiersze,stekst.str());
    findInStr(znakiCzarne,ileZnakiCzarne,stekst.str());
 
    cout << "Slowa = " << --slowa << endl;
    cout << "Wiersze = " << wiersze << endl;
    cout << "Biale znaki = " << ileZnakiBiale << endl;
    cout << "Czarne znaki = " << ileZnakiCzarne << endl;
 
 
    return 0;
}
| Sklep z artykułami dla dzieci | | Wózki dla dzieci | | Opony motocyklowe | | Opony zimowe | | Opony specjalne | | Skróć link | | Blogi za darmo | | Opisy na Facebooka | | Pionowe opisy |