Click here to Skip to main content
15,921,226 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
QuestionWhat's the benefit using serialization? Pin
Anonymous22-Nov-04 9:43
Anonymous22-Nov-04 9:43 
AnswerRe: What's the benefit using serialization? Pin
David Crow22-Nov-04 10:43
David Crow22-Nov-04 10:43 
AnswerRe: What's the benefit using serialization? Pin
Blake Miller23-Nov-04 9:26
Blake Miller23-Nov-04 9:26 
GeneralAcess and C++ application Pin
krimkrim22-Nov-04 8:54
krimkrim22-Nov-04 8:54 
GeneralRe: Acess and C++ application Pin
BaldwinMartin23-Nov-04 10:06
BaldwinMartin23-Nov-04 10:06 
GeneralNeed help for this assignment.... Pin
rudylili22-Nov-04 8:04
rudylili22-Nov-04 8:04 
GeneralRe: Need help for this assignment.... Pin
David Crow22-Nov-04 8:47
David Crow22-Nov-04 8:47 
GeneralRe: Need help for this assignment.... Pin
namaskaaram22-Nov-04 23:49
namaskaaram22-Nov-04 23:49 
Wink | ;)
hmmm.....having a hard time ,huh......chillout....assuming u know the basics.....herez a skeletal prgm.....

//since they have asked for atleast six functions,herez how i have seperated em as.....
#include<iostream.h>
#include<conio.h>

void getdata(int a,int b);
void convert(int num,int roman[]);
void add_roman_numeralz(int roman1[],int roman2[],int romansum[]);
void carry_correction(int roman[]);
void display_romansum(int roman[]);

void main(void)
{
int num1,num2,sum;
int roman1[7]=NULL,roman2[7]=NULL,roman3[7]=NULL;

clrscr();

//get the data from the user.....
getdata(num1,num2);

//convert num1 into roman
convert(num1,roman1);

//convert num2 into roman
convert(num2,roman1);

//perform the roman addition and get the added value in roman3
add_roman_numeralz(roman1,roman2,roman3);

//perform the carry correction for the added roman3
carry_correction(roman3);

//display the roman3
display_romansum(roman3);

getch();

}//end of void main(void)



void getdata(int &a,int &b)
{
cout<<"Enter the first number : ";
cin>>a;
cout<<"Enter the second number : ";
cin>>b;
}//end of the function



void convert(int num,int roman[7])
{

while(num>=1000)
{
roman[6]+=1;
num-=1000;
}
while(num>=500)
{
roman[5]+=1;
num-=500;
}
while(num>=100)
{
roman[4]+=1;
num-=100;
}
while(num>=50)
{
roman[3]+=1;
num-=50;
}
while(num>=10)
{
roman[2]+=1;
num-=10;
}
while(num>=5)
{
roman[1]+=1;
num-=5;
}
while(num>=1)
{
roman[0]+=1;
num-=1;
}

}//end of the function


void add_roman_numeralz(int roman1[7],int roman2[7],int romansum[7])
{

for(i=0;i<7;i++)
romansum[i]=roman1[i]+roman2[i];

}//end of function


void carry_correction(int roman[7]);
{

while(roman[0]>=5)//safer to give while,u can give if as well
{
roman[1]+=1;
roman[0]-=5;
}
while(roman[1]>=10)//safer to give while,u can give if as well
{
roman[2]+=1;
roman[1]-=10;
}
while(roman[2]>=50)//safer to give while,u can give if as well
{
roman[3]+=1;
roman[2]-=50;
}
while(roman[3]>=100)//safer to give while,u can give if as well
{
roman[4]+=1;
roman[3]-=100;
}
while(roman[4]>=500)//safer to give while,u can give if as well
{
roman[5]+=1;
roman[4]-=500;
}
while(roman[5]>=1000)//safer to give while,u can give if as well
{
roman[6]+=1;
roman[5]-=1000;
}

}//end of function


void display_romansum(int roman[]);
{
for(i=0;i<7;i++)
cout<<roman[i]<<"\n";

}//end of function


hope that helpz.....(never tried it out.....)

cheerz
Big Grin | :-D
GeneralRe: Need help for this assignment.... Pin
rudylili23-Nov-04 3:51
rudylili23-Nov-04 3:51 
GeneralSomething is not releasing the resources after program quits Pin
Budric B.22-Nov-04 7:50
Budric B.22-Nov-04 7:50 
GeneralRe: Something is not releasing the resources after program quits Pin
Maximilien22-Nov-04 8:18
Maximilien22-Nov-04 8:18 
Generaldon't know Pin
Budric B.22-Nov-04 8:47
Budric B.22-Nov-04 8:47 
Generalstatic transparent background Pin
LukeV22-Nov-04 7:44
LukeV22-Nov-04 7:44 
GeneralRe: static transparent background Pin
BaldwinMartin23-Nov-04 10:09
BaldwinMartin23-Nov-04 10:09 
GeneralOutput help Pin
Anonymous22-Nov-04 7:36
Anonymous22-Nov-04 7:36 
GeneralRe: Output help Pin
David Crow22-Nov-04 8:05
David Crow22-Nov-04 8:05 
GeneralRe: Output help Pin
namaskaaram22-Nov-04 18:36
namaskaaram22-Nov-04 18:36 
GeneralRe: Output help Pin
namaskaaram22-Nov-04 22:17
namaskaaram22-Nov-04 22:17 
QuestionHow can I know where a program leaks memory if it hangs after 48 hours of working? Pin
Joan M22-Nov-04 6:45
professionalJoan M22-Nov-04 6:45 
AnswerRe: How can I know where a program leaks memory if it hangs after 48 hours of working? Pin
BlackDice22-Nov-04 8:46
BlackDice22-Nov-04 8:46 
AnswerRe: How can I know where a program leaks memory if it hangs after 48 hours of working? Pin
floresa922-Nov-04 11:54
floresa922-Nov-04 11:54 
Generalslider Pin
teneff22-Nov-04 4:42
teneff22-Nov-04 4:42 
GeneralRe: slider Pin
David Crow22-Nov-04 4:51
David Crow22-Nov-04 4:51 
GeneralRe: slider Pin
teneff22-Nov-04 5:18
teneff22-Nov-04 5:18 
GeneralRe: slider Pin
David Crow22-Nov-04 6:12
David Crow22-Nov-04 6:12 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.