s t r i n g n.
Download
Skip this Video
Loading SlideShow in 5 Seconds..
S T R I N G PowerPoint Presentation
Download Presentation
S T R I N G

Loading in 2 Seconds...

play fullscreen
1 / 5

S T R I N G - PowerPoint PPT Presentation


  • 143 Views
  • Uploaded on

S T R I N G. Dalam C++, String adalah kumpulan (array) dari karakter. Bentuk : char Nama Variabel_string[jml karakter] Contoh : char kata[20] ; Dalam C++ terdapat beberapa fungsi siap pakai yang berguna untuk memanipulasi data string.

loader
I am the owner, or an agent authorized to act on behalf of the owner, of the copyrighted work described.
capcha
Download Presentation

PowerPoint Slideshow about 'S T R I N G' - amandla


An Image/Link below is provided (as is) to download presentation

Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author.While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server.


- - - - - - - - - - - - - - - - - - - - - - - - - - E N D - - - - - - - - - - - - - - - - - - - - - - - - - -
Presentation Transcript
slide2

Dalam C++, String adalah kumpulan (array) dari karakter.

Bentuk : char Nama Variabel_string[jml karakter]

Contoh : char kata[20] ;

Dalam C++ terdapat beberapa fungsi siap pakai yang berguna

untuk memanipulasi data string.

Untuk menggunakan fungsi-fungsi tersebut kita harus menyertakan file header : string.h. didalam program

slide4

#include<iostream.h>

#include<conio.h>

#include<string.h>

main()

{

char kata[100],i,b[]="_________________________________________";

gotoxy(15,6);cout << "PROGRAM UNTUK MEMBALIK URUTAN KARAKTER" << endl;

gotoxy(22,7);cout << "DALAM SUATU KALIMAT" << endl;

gotoxy(15,8);cout << b << endl;

gotoxy(20,10);cout << "Masukan sebuah kalimat : "<< endl;

gotoxy(20,12);cin.get(kata,100);

clrscr();

gotoxy(20,9);cout << b << endl;

gotoxy(20,11);cout << "kalimat Sebelum dibalik " << endl;

gotoxy(25,13);cout <<'"' << (kata) << '"' << endl;

gotoxy(20,15);cout << "Kalimat setelah dibalik ";

gotoxy(25,17);cout << '"' << strrev(kata) << '"'<<endl;

gotoxy(20,19);cout << b << endl;

return 0 ;

}

slide5

#include<iostream.h>

#include<conio.h>

#include<string.h>

main()

{

static char huruf[10] =

{'A','I','U','E','O','a','i','u','e','o'} ;

char *ptrkar ;

char kar,nama[20];

char grs[]=“ ______________________";

int i,pjg,vokal,konsonan;

gotoxy(15,3);cout << "PROGRAM UNTUK

MENGHITUNG HURUF VOKAL & KONSONAN";

gotoxy(10,4);cout <<grs ;

gotoxy(10,8);cout <<grs ;

gotoxy(20,6);cout << "MASUKKAN SEBUAH KATA : ";

cin >> nama;

clrscr();

pjg = strlen(nama);

vokal = 0,konsonan = 0 ;

for (i=0 ; i<pjg;i++)

{

kar = nama[i];

ptrkar = strchr(huruf,kar);

if (ptrkar !=0)

{

vokal = vokal + 1;

}

else

{

konsonan = konsonan +1 ;

}

}

gotoxy(10,5);cout<< grs ;

gotoxy(15,7);cout<< "KATA " <<"' "<< strupr(nama)<<" '" << " Terdiri dari :";

gotoxy(20,9);cout<< vokal << " Huruf Vokal " ;

gotoxy(20,10);cout<< konsonan << " Huruf Konsonan" ;

gotoxy(10,12);cout<< grs ;

return 0 ;

}