Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

function bool intTest? Í don´t know.

Status
Not open for further replies.

psycho230

Programmer
Dec 2, 2002
1
AT
Sorry, i don´t speak english very well, but i will try it.

create a function bool intTest (int n, char c), which tests if the figure c occurs in the number n. dont use loops in the functiondefinition.

i dont know how to solve this problem.please help me.
thanks, jo.
 
First, convert the int to an std::string or a char*. If you're using an std::string, use std::stringstream. If you're using a char*, use sprintf.

Next, do some kind of search for the character on the string. If you're using std::string, use its built-in find member function. If you're using a char*, use the strchr function.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top