Dev C++
Would you like to react to this message? Create an account in a few clicks or log in to continue.
Search
 
 

Display results as :
 


Rechercher Advanced Search

Latest topics
Navigation
 Portal
 Index
 Memberlist
 Profile
 FAQ
 Search

Pronadji broj slova u poruci

Go down

Pronadji broj slova u poruci Empty Pronadji broj slova u poruci

Post  Don Corleone Wed Apr 13, 2011 11:40 pm


#include<stdio.h>
#include<conio.h>
#include<string.h>

int main(){

char poruka[20];
char slovo;
int brojac=0;
printf ("Program za pronalazenje ponavljana odredjenog slova u poruci max duzine 20 karaktera\n");
printf("Unesi neku poruku max duz 20 chara \n");
gets(poruka); //citaj ceo red sa ekrana

printf ("Koje slovo zelis da prebrojis \n");
printf("\n Slovo=");slovo=getch(); // uzmi znak sa tastature


for (int i=0;i<strlen(poruka);i++){
if (poruka[i]==slovo) brojac++;
}
printf ("\n Broj pronadjenih slova '%c' je %d u poruci '%s' duzina poruke je %d znakova", slovo,brojac,poruka,strlen(poruka));
getch();
}
Don Corleone
Don Corleone
Admin

Posts : 148
Join date : 2009-10-28
Age : 31
Location : Sombor - Serbia

https://programing.forumotion.com

Back to top Go down

Back to top


 
Permissions in this forum:
You cannot reply to topics in this forum