Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <fstream>
- #include <string>
- #include <string.h>
- using namespace std;
- int main() {
- int nr_cuvinte;
- char virgula[1] = { ',' };
- char punct = '.';
- char cuvant[10];
- nr_cuvinte = 0;
- ifstream f("cuvant.txt");
- while (f>>cuvant) {
- int rezultat = strcmp(cuvant,",");
- int rezultat2 = strcmp(cuvant, ".");
- if (rezultat != 0 && rezultat2 !=0 ) {
- nr_cuvinte++;
- }
- }
- cout << "Am descoperit " << nr_cuvinte << " cuvinte";
- system("pause");
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement