xxxxxxxxxx
#include <iostream>
#include <conio.h>
using namespace std;
int a(const char *y){
int x=0;
for(; *y!='\0'; y++)
++x;
return x;
}
int getch(){
char huruf[150];
cout<<"\t\17 Menghitung Jumlah Karakter dengan POINTER C++ \17\n\n";
cout<<"Input Kalimat : "; cin.getline(huruf,150);
cout<<"\n......................................................................"<<endl;
cout<<"\nJumlah karakter dari kalimat diatas adalah : "<<a(huruf)<<" Karakter"<<endl;
}
xxxxxxxxxx
#include<iostream.h>
#include<conio.h>
void main()
{
int a=10, b=20;
int sum=0;
clrscr(); // use clrscr() after variable declaration
sum=a+b;
cout<<"Sum: "<<sum;
getch();
}