Created
May 2, 2018 10:49
-
-
Save Zemaaan/116249110617bc0de6a745af0bd116d4 to your computer and use it in GitHub Desktop.
Programiranje vjezbe 2.5.2018 - 3. zadatak
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; | |
bool sadrzi_slovo(string rijec, char slovo) { | |
for (int pozicija = 0; pozicija < rijec.length(); pozicija++) { | |
if (rijec[pozicija] == slovo) { | |
return true; | |
} | |
} | |
} | |
int main() | |
{ | |
string rijec; | |
char slovo; | |
cout << "Upisi rijec: " << endl; | |
cin >> rijec; | |
cout << "Upisi slovo koje se trazi: " << endl; | |
cin >> slovo; | |
if (sadrzi_slovo(rijec, slovo) == true) { | |
cout << "Rijec " << rijec << " sadrzi slovo " << slovo << "."<< endl;} | |
else{ cout << "Rijec " << rijec << " ne sadrzi slovo " << slovo << "." << endl; } | |
system("pause"); | |
return 0; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment