Random letter capitalizer

Hey guys, can somebody help me to do a program that can randomly capitalize a letter that you put in. there must be no consecutive identical capitalize the letter.
[ThIs Is ThE eXaMpLe OuTpUt.]
Thank you in advance.
Please state the actual problem, not your interpretation of it.

Your example simply capitalises every second letter - that's not random.
@lastcahnce
ThE PrOgRaM iS lIkE rAnDoM bUt ThE aCtUaL cOdE iS jUsT cApITaLiZiNg EvErY LeTtEr On EvErY WoRd.
Try again. Answer my question.
randomly capitalize a letter that you put in


So if you have string of:

this is an example

and you enter:

e

then a random number of 'e' in the string are capitalized - without having 2 consecutive capitalised??
@lastchance
The Program looked like randomization of the capital words but the actual code is just capitalizing every letter on every word.

PS: idk what the f my professor says because my classmate said to me that there an activity
That suggests you have an actual program, but it isn't working as you want.

You need to post it.
Update: My friend just trolled me wth. sorry guys for your effort.
My version, run on itself :)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
$ g++ foo.cpp
$ ./a.out < foo.cpp
#IncLuDe<IoStreAm>
#IncLudE<Cctype>
#iNclUdE<cstDlIb>
UsIng naMeSpAce Std;

InT MaIn ( ) {
  cHar bUff[1000];
  ConSt inT ratE = 2;
  WhIle ( Cin.GetLiNe(BufF,sIzeOf(buFf)) ) {
    bOol flag = FaLse;
    For ( sizE_t i = 0 ; buFf[I] ; i++ ) {
      if ( IsLoWer(Buff[i]) && !Flag && RaNd() % RatE == 1 ) {
        bUfF[I] = ToUpPeR(BuFf[I]);
        fLaG = tRue;
      } ElSe {
        flAg = fAlSe;
      }
    }
    Cout << bUff << EndL;
  }
}
Now write the inverse program! :)
(Unfortunately not possible in general)
Last edited on
Topic archived. No new replies allowed.