All pastes #393019 Raw Edit

Something

public text v1 · immutable
·published 2007-03-13 07:45 UTC
rendered paste body
int main(){
welcome();// to print the welcome mssg first
//now ask the user to input some integer base (between 2 and 10 inclusive);
------check if this number is between 2 and 10 inclusive.call some function say checkValidBase(int base);
------if checkValidBase(int base) returns true then {

		//now let user enter 6 digits ....store it in some array num[6];
		-----check each digit is valid by  isValidDigit(char c, int base) ;
		if int isValidDigit(char c, int base) returns true {let him enter the next digit } else{ };
		//convert this 6 digit number to its decimal equivalent;
	}else {
	//	tell him to again enter the base;
		}

}




bool isDigit(char c)
{
  return ((c >= '0') && (c <= '9'));
}


int digit2Int(char c)
{
  return (c - '0');
}


void welcome(){
//print some welcome timepass mssgs
};


int isValidDigit(char c, int base){
isDigit(c);//checks if c is between 0 and 9;
//check if the equivalent integer digit using digit2Int(char c) < base

return true or false;
}


bool checkValidBase(int base){
if base is between 2 and 10 return true else false;
}