So I'm trying to get this done by using bool and then some simple if statements but for some reason it either doesn't capitalize anything or capitalizes everything if I remove the last if statement. I don't know if I set up the bool parameters correctly..
#include <cstdio>
#include <iostream>
using namespace std;
int main ()
{
int c = cin.get() ;
bool fletter = true ;
if(c == ' ' || c == '\t' || c == '\n');
// fletter = true;
do
{
if (fletter = true); {
c = toupper(c);
fletter = false;
}
{if (fletter = false);
c = tolower(c);
}
cout.put(c) ;
c = cin.get() ;
}while ( !cin.eof()) ;
}
Aucun commentaire:
Enregistrer un commentaire