hey all,,,
i've been trying to make my own setw function that will do the same jop of setw,, this is my first year in college i study CIS in Jordan,,,
so, i made this code but6 i still have problims with float numbers, it seems like this code work on int numbers,, as u can see i've used my function in an example,,,,
plz help :D
#include<iostream.h>
#include<math.h>
void myset( int w, float num ){
int n=0;
float num1 = fabs(num);
while (num1 >= 1){
num1/=10;
n++;
}
for ( int i =0; i < w-n; i++){
cout<< "0";
}
cout<<num<<endl;
}// end of the function
main ()
{
int w;
float num;
cout <<"enter the number"<<endl;
cin >>num;
cout<<"enter the number of the spaces"<<endl;
cin >> w;
myset(w, num);
}