*Originally posted by Alabsi *
**I made a function that give the value of any number like the way you read it. For example you have the number "144566" the out put of the function will be printed to the secreen as follows:11241526**

That, in no way, makes any sense, whatsoever. Could you explain that?

Some tips (shorthand, basically)

instead of count=count+1; do count++; It does the same thing.

instead of temp1=temp1/10; do temp1/=10 it does the same thing too

instead of base=base*10 do base*=10 (same thing again)

I'll edit your code to reflect this so you can see what I mean...it's just a shorter and clearer way of writing things

Code:

#include<iostream>
#include <climits>
using namespace std;
int main (){
unsigned long int num,temp2,
n,count,diviser,digit,i,counter,temp1,base;
n=1;
cout<<"Please enter the number :"<<endl; //getting input
cin>>num;
temp1=num;
count=0;
while (temp1!=0){ //counting number of digits
temp1/=10;
count++;
}
cout<<"The look-and-say value of the given number is :";
i=1;
temp2=0;
counter=1;
count++;
base=1;
for(int r=1;r<=count;r++){ // to get the power of 10
base*=10;
}
diviser=base;
for (i=1; i<=count;i++) { //seperating each digit
//and printing output
diviser/=10;
digit=num/diviser;
if (i> 2){
if(temp2==digit)
counter++;
else {
cout<<counter<<temp2;
counter=1;
}
}
temp2=digit;
num%=diviser;
}
//no need to make two calls to cout, just stick endl on the first
cout<<counter<<temp2<<endl;//this to show the last digit
return 0;
}

As for what that's supposed to do... you lost me. Could you clarify?