#include <cstdlib>
#include <iostream>
using namespace std;
class aku{
friend istream& operator >>(istream&,aku&);
friend ostream& operator <<(ostream&,aku&);
public :
void proses();
private :
char a[1000];
int hasil;
};
istream& operator >>(istream& in, aku& x){
cout<<"Inputkan suatu kalimat atau kata : " <<endl;
in.getline(x.a,sizeof(x.a));
}
void aku::proses(){
int i=0;
while(i<=strlen(a)){
hasil=i;
i++;
}
}
ostream& operator <<(ostream& out,aku& y){
y.proses();
cout<<"Jumlah Karakter semua hurufnya adalah : " <<y.hasil;
}
int main(int argc, char *argv[])
{
aku run;
cin>>run;
cout<<run;
cout<<endl;
system("PAUSE");
return EXIT_SUCCESS;
}
Jumat, 02 Maret 2012
menghitung karakter huruf
Langganan:
Posting Komentar (Atom)
0 komentar:
Posting Komentar