simple conversion from C to C++
From: news.hku.hk (billychu_at_hkusua.hku.hk)
Date: 04/30/04
- Next message: JKop: "Re: Initialization of virtual function table pointer"
- Previous message: Der Andere: "Re: [OT] STL sort on arrays of pointers"
- Next in thread: Mike Wahler: "Re: simple conversion from C to C++"
- Reply: Mike Wahler: "Re: simple conversion from C to C++"
- Maybe reply: Christopher Benson-Manica: "Re: simple conversion from C to C++"
- Reply: Christopher Benson-Manica: "Re: simple conversion from C to C++"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: Sat, 1 May 2004 00:43:26 +0800
can any one translate the following codes into c++ codes, coz i can't run
the "printf" command in Unix and it said it's implicit declaration.
Is it only the two lines with comment need to be re-written??
Thanks a lot
void _display_number(int v, int n){
if(v >= 1000){
int r = v % 1000;
_display_number(v / 1000,n);
printf(",%03d",r); // how to translate that into
std::cout<<...?
}else{
printf("%s%d\n",n ? "-":"",v); // how to translate
}
}
void display_number(int v){
_display_number(v < 0 ? -v : v,v < 0);
}
- Next message: JKop: "Re: Initialization of virtual function table pointer"
- Previous message: Der Andere: "Re: [OT] STL sort on arrays of pointers"
- Next in thread: Mike Wahler: "Re: simple conversion from C to C++"
- Reply: Mike Wahler: "Re: simple conversion from C to C++"
- Maybe reply: Christopher Benson-Manica: "Re: simple conversion from C to C++"
- Reply: Christopher Benson-Manica: "Re: simple conversion from C to C++"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
|