click on participate and please see the code editor on the right side. In the code skeleton there, you can see a function with taking two arguments,both character arrays.

I know a method to solve this problem if both the arrays were integer arrays.

the function signature cannot be modified.

If you don't wanna create an account in the site, here's the problem statement:

Two persons are playing a game of rolling 2 dices. Each person roll the two dices n times and record the outcomes( sum of value of two dices) of all the n attempts. So after n attempts of both the player we have two list corresponding to the n outcomes of two players. They want to know that whether they have got all possible outcomes( 2 to 12) same number of times or not. If they got all the possible outcomes same number of times then they are called lucky otherwise unlucky. So the question is that you have two list corresponding to the outcomes of two players you have to decide that whether the two players are lucky or not.

the code has to be written inside the function without changing the signature. I know a method to solve this problem if both the arrays were integer arrays.

``````void rolling_dice(char* input1,char* input2)
{
//Write code here
}
``````

Look up ASCII values and then `if (ASCII_value_of(some var) == 30) then set the element of an integer array to <soemthing>`

No conversion is necessary, characers are nothing more than small one-byte integers with a range of values -127 to 126 or unsigned 0 to 255. You simply treat then as if they …

## All 5 Replies

Look up ASCII values and then `if (ASCII_value_of(some var) == 30) then set the element of an integer array to <soemthing>`

No conversion is necessary, characers are nothing more than small one-byte integers with a range of values -127 to 126 or unsigned 0 to 255. You simply treat then as if they were int arrays.

``````#include <iostream>
using namespace std;

int main(){
cout<<'a'+0; //prints out the ascii number of character 'a'
return (0);
}
``````

`cout<<'a'+0;`?? You're kidding, right?

Standard way to do this is `cout << (int)'a';`

You're kidding, right?

Not quite

Standard way to do this is cout << (int)'a';

I didn't say it was the standard way, just said that it could help him...

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts learning and sharing knowledge.