laurence
Newbie level 1
about Borland C++ 5.5.1 for win32 command line tool, EditPlus&UltraEdit
just downloaded a Borland C++ 5.5.1 for win32 command line tool,with EditPlus &UltraEdit to learn algorithm,written a program in C to find the digits of every input x-based number.
#include <stdio.h>
int digits(int n,int base);
int main(){
int myNumber,myBase;
scanf(\"Please input the number= %d\",&myNumber);
scanf(\"Please input the base= %d\",&myBase);
digits(myNumber,myBase);
}
int digits(int n,int base){
if(n<base) return n;
else {
printf(\"the digits are(from the least significant)\\n%d\",n%base);
return digits(n/base,base);
}
}
when bss32.exe in editplus, no resopnse?Can anyone tell me what happened?
Changed to C++,everything is OK,what happended?
#include <iostream.h>
int digits(int n,int base);
int main(){
int myNumber,myBase;
cout<<\"Please input the number=\"<<endl;
cin>>myNumber;
cout<<\"Please input the base=\"<<endl;
cin>>myBase;
digits(myNumber,myBase);
}
int digits(int n,int base){
if(n<base) {
cout<<\"The Most significant digit is \"<<n<<endl;
return n;}
else {
cout<<\"the digits are(from the least significant)\"<<n%base<<endl;
return digits(n/base,base);
}
}
Besides,how to run the compiled file of .exe in editplus without changing the toolbar command's setting each time?
All the above programs in ultraEdit contain clauses like scanf,cin will have a problem, what to do?
many thanks!
just downloaded a Borland C++ 5.5.1 for win32 command line tool,with EditPlus &UltraEdit to learn algorithm,written a program in C to find the digits of every input x-based number.
#include <stdio.h>
int digits(int n,int base);
int main(){
int myNumber,myBase;
scanf(\"Please input the number= %d\",&myNumber);
scanf(\"Please input the base= %d\",&myBase);
digits(myNumber,myBase);
}
int digits(int n,int base){
if(n<base) return n;
else {
printf(\"the digits are(from the least significant)\\n%d\",n%base);
return digits(n/base,base);
}
}
when bss32.exe in editplus, no resopnse?Can anyone tell me what happened?
Changed to C++,everything is OK,what happended?
#include <iostream.h>
int digits(int n,int base);
int main(){
int myNumber,myBase;
cout<<\"Please input the number=\"<<endl;
cin>>myNumber;
cout<<\"Please input the base=\"<<endl;
cin>>myBase;
digits(myNumber,myBase);
}
int digits(int n,int base){
if(n<base) {
cout<<\"The Most significant digit is \"<<n<<endl;
return n;}
else {
cout<<\"the digits are(from the least significant)\"<<n%base<<endl;
return digits(n/base,base);
}
}
Besides,how to run the compiled file of .exe in editplus without changing the toolbar command's setting each time?
All the above programs in ultraEdit contain clauses like scanf,cin will have a problem, what to do?
many thanks!