1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36
|
#include <iostream>
#include <string>
using namespace std;
int getNumber();
void centize(string, string*, string*,string*,string*);
char* itoa(int, int);
int main()
{
string s_number=itoa(getNumber(),10);
string* cent4 = new string;
string* cent3 = new string;
string* cent2 = new string;
string* cent1 = new string;
centize(s_number, cent4, cent3, cent2, cent1); //break down into sets of hundreds */
return 0;
}
int getNumber()
{
//code
}
void centize(string sNum, string* c4, string* c3, string* c2, string* c1)
{
//starting fromt the last digit, substring three digits and pop them into a cent string.
int length = sNum.length();
cout<<length<<endl;
c1 = sNum.substr((length-3),length);
cout<<c1<<endl;
}
|