Random letter capitalizer

Dec 9, 2020 at 9:42am
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.
Dec 9, 2020 at 11:00am
Please state the actual problem, not your interpretation of it.

Your example simply capitalises every second letter - that's not random.
Dec 9, 2020 at 11:10am
@lastcahnce
ThE PrOgRaM iS lIkE rAnDoM bUt ThE aCtUaL cOdE iS jUsT cApITaLiZiNg EvErY LeTtEr On EvErY WoRd.
Dec 9, 2020 at 11:16am
Try again. Answer my question.
Dec 9, 2020 at 11:51am
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??
Dec 9, 2020 at 12:05pm
@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
Dec 9, 2020 at 12:10pm
That suggests you have an actual program, but it isn't working as you want.

You need to post it.
Dec 9, 2020 at 12:27pm
Update: My friend just trolled me wth. sorry guys for your effort.
Dec 9, 2020 at 1:47pm
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;
  }
}
Dec 9, 2020 at 2:13pm
Now write the inverse program! :)
(Unfortunately not possible in general)
Last edited on Dec 9, 2020 at 2:18pm
Topic archived. No new replies allowed.