Created
September 19, 2017 16:24
-
-
Save myusufid/8ba571f7f35214035077fca8e936c14a to your computer and use it in GitHub Desktop.
This file contains hidden or 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
#include <iostream> | |
#include <stdio.h> | |
#include <conio.h> | |
#include <string> | |
#include <cstdlib> | |
using namespace std; | |
int search_some_character(){ | |
//Binary Search | |
cout<<"Mengganti Karakter 'a' menjadi 'A'\n\n"; | |
cout<<"Kalimat : Universitas Negeri Malang\n"; | |
char kalimat[] = "Universitas Negeri Malang"; | |
char dicari[] = "a"; | |
char ganti[]= "A"; | |
int panjang,i; | |
panjang = strlen(kalimat); | |
for(i=0; i<panjang; i++){ | |
if(kalimat[i] == dicari[0]){ | |
kalimat[i] = ganti[0]; | |
} | |
} | |
cout<<"Menjadi : "; | |
cout<<kalimat; | |
} | |
int main(){ | |
search_some_character(); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment