// Example program
#include <iostream>
int main ()
{
std::cout << int('C') << " " << int('W'); // 67 87
}
so you need 3 non-repeated random value from 67 to 87.
EDIT:
example process:
set1: AB, C(67) W(87) W(87)
set2: AB, C P M (ok after comparing previous sets)
set2: AB, C W W (woops. it has been equal to a previous set, so it should be re-calculated.)
I learnt the 5 unrepeatable subset that will be generated will be 1330 in number.
There are 21 letters from C to W. The total number of 3 letter sequences with non-repeating letters would be 21 * 20 * 19 = 7980, which is much larger than 1330.
1 2 3 4 5 6 7 8 9 10 11
#include <iostream>
int main()
{
int counter = 0;
for (int i = 0; i < 19; ++i)
for (int j = i + 1; j < 20; ++j)
for (int k = j + 1; k < 21; ++k)
++counter;
std::cout << counter;
}
1330
Therefore, OP wants sequences where each successive letter comes after the letter before it in the alphabet.
set1: AB, C(67) W(87) W(87) (not OK, W does not come after W)
set2: AB, C P M (not OK, M does not come after P)
set3: AB, C P W (OK)
There are 21 letters from C to W. The total number of 3 letter sequences with non-repeating letters would be 21 * 20 * 19 = 7980, which is much larger than 1330.
>
set1: AB, C(67) W(87) W(87) (not OK, W does not come after W)
set2: AB, C P M (not OK, M does not come after P)
set3: AB, C P W (OK)
if you do by "come after" method, total set wont be 7980.
a big thank you to fg10g and anup30 and every other person that contributed here. here is an hint to further help you guys understand what I really want:
The set generated must start with AB at every point, this means AB is constant. apart from AB, every other set generated must not have repeated letters and this must iterate till the letter W.
An output of it will look like this:
ABCDE
ABCDF
ABCDG
ABCDH
ABCDI
ABCDJ
ABCDK
ABCDL
ABCDM
ABCDN
ABCDO
ABCDP
SBCDQ
ABCDR
ABCDS
ABCDT
ABCDU
ABCDV
ABCDW
AND SO ON AND SO FORTH TILL THE last set is generated.
I will like to see the final output pasted here. let's use char so that it will take care of the generated set. also show us the code. expecting your response soonest.
you have to also prompt for the letters A -W to be captured from the keyboard and also print the entire output (un-repeated) sets generated at the end. thanks
but you saw the sets I generated above. I need the code to generate the rest of the outputs. thanks. please help if you know the coding. am here to learn. of course you've been resourceful here, pls kindly give me your best answer with respect to the explanations I gave above.
That only shows your understanding of the problem. You're supposed to write the code for it. You're asking people to solve it for you without showing any code proving you have attempted to do it on your own.
At any rate, I practically gave you a solution in my first post. Maybe this would be easier to understand:
1 2 3 4 5 6 7 8 9
#include <iostream>
int main()
{
for (int i = 3; i < 22; ++i)
for (int j = i + 1; j < 23; ++j)
for (int k = j + 1; k < 24; ++k)
std::cout << "1, 2, " << i << ", " << j << ", " << k << '\n';
}
#include <iostream>
int main()
{
for ( char i = C; i < V; ++C)
for ( char j = ++C; j < W; ++D)
for ( char k = ++D; k < X; ++E)
std::cout << "A, B, " << i << ", " << j << ", " << k << '\n' ;
}
I attempted running this but had so many errors. I actually want to generate the output in char format and not in integer format. final help from you pls, thanks