Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <fstream>
- #include <cctype>
- #include <cstring>
- using namespace std;
- const int SIZE = 80;
- int sentenceCounter(int array[SIZE]) {
- int count = 0;
- for (int i = 0; i <= sizeof(array); i++) {
- if (array[i] = '.') {
- count++;
- }
- } return count;
- }
- int spaceCounter(int array[SIZE]) {
- int counter = 0;
- for (int i = 0; i <= sizeof(array); i++){
- if (isblank(array[i]))
- counter++;
- }
- return counter;
- }
- int puntctuationCounter(int array[SIZE]) {
- int counting = 0;
- for (int i = 0; i <= sizeof(array); i++) {
- if (ispunct(array[i]))
- counting++;
- }return counting;
- }
- int numberCounter(int array[SIZE]) {
- int counted = 0;
- for (int i = 0; i <= sizeof(array); i++) {
- if (isdigit(array[i])) {
- counted++;
- }
- }
- return counted;
- }
- int wordCounter(int array[SIZE]) {
- int countt = 0;
- for (int i = 0; i <= sizeof(array); i++) {
- if (array[i] == ' ' && array[i] == '\0') {
- countt++;
- }
- }return countt;
- }
- int lineCounter(int array[SIZE]) {
- int countedd = 0;
- for (int i = 0; i <= sizeof(array); i++) {
- if (array[i] == '\0') {
- countedd++;
- }
- }return countedd;
- }
- int main() {
- int number, sentence, space, punct, word,line;
- char array = SIZE;
- int i = 0;
- ifstream file_reader("havenotcreatedthefileyet.txt");
- while (is.get(file_reader, array)) {
- for (int i = 0; i <= SIZE; i++) {
- }
- number = numberCounter();
- sentence = sentenceCounter();
- space = spaceCounter();
- punct = puntctuationCounter();
- word = wordCounter();
- line = lineCounter();
- cout << "Number of Numbers : " << number << endl;
- cout << " Number of Sentences : " << sentence << endl;
- cout << "Number of Spaces : " << space << endl;
- cout << " Number of Punctuation marks : " << punct << endl;
- cout << "Number of Words : " << word << endl;
- }return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement