Last active
April 25, 2018 11:10
-
-
Save Zemaaan/0715e651ea59cf120ba60d631ab26979 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// ConsoleApplication1.cpp : Defines the entry point for the console application. | |
// | |
#include "stdafx.h" | |
#include <iostream> | |
#include <string>; | |
using namespace std; | |
int main() | |
{ | |
string recenica; | |
int brojac_rijeci = 0; | |
cout << "Upisi recenicu: "; | |
cin >> recenica; | |
for (int pozicija = 0; pozicija < recenica.length() - 1; pozicija++) { | |
if (recenica[pozicija] == ' ') { | |
brojac_rijeci++; | |
} | |
} | |
brojac_rijeci++; | |
cout << "Recenica ima: " << brojac_rijeci << " rijeci." << endl; | |
system("pause"); | |
return 0; | |
} | |
// ConsoleApplication1.cpp : Defines the entry point for the console application. | |
// | |
#include "stdafx.h" | |
#include <iostream> | |
#include <string>; | |
using namespace std; | |
int main() | |
{ | |
string recenica; | |
int brojac_rijeci = 0; | |
cout << "Upisi recenicu: "; | |
getline(recenica); | |
for (int pozicija = 0; pozicija < recenica.length() - 1; pozicija++) { | |
if (recenica[pozicija] == ' ') { | |
brojac_rijeci++; | |
} | |
} | |
brojac_rijeci++; | |
cout << "Recenica ima: " << brojac_rijeci << " rijeci." << endl; | |
system("pause"); | |
return 0; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment