how to solve the errors of this program
Posted
by hussein abdullah
on Stack Overflow
See other posts from Stack Overflow
or by hussein abdullah
Published on 2010-06-05T18:28:56Z
Indexed on
2010/06/05
18:32 UTC
Read the original article
Hit count: 292
visual-studio-2008
include
using std::cout; using std::cin; using std::endl;
include
void initialize(char[],int*); void input(const char[] ,int&); void print ( const char*,const int); void growOlder (const char [], int* );
bool comparePeople(const char* ,const int*,const char*,const int*);
int main(){
char name1[25];
char name2[25];
int age1;
int age2;
initialize (name1,&age1);
initialize (name2,&age2);
print(name1,*age1);
print(name2,*age2);
input(name1,age1);
input(name2,age2);
print(&name1,&age1);
print(&name2,&age2);
growOlder(name2,age2);
if(comparePeople(name1,&age1,name2,&age2))
cout<<"Both People have the same name and age "<<endl;
return 0;
}
void input(const char name[],int &age) { cout<<"Enter a name :"; cin>>name ;
cout<<"Enter an age:";
cin>>age;
cout<<endl;
}
void initialize ( char name[],int *age)
{
name="";
age=0;
}
void print ( const char name[],const int age )
{
cout<<"The Value stored in variable name is :"
<
void growOlder(const char name[],int *age) { cout<< name <<" has grown one year older\n\n"; *age++; } bool comparePeople (const char *name1,const int *age1, const char *name2,const int *age2) {
return(age1==age2 &&strcmp(name1,name2));
}
© Stack Overflow or respective owner