35 lines
542 B
C++
35 lines
542 B
C++
#include <iostream>
|
|
#include <cctype>
|
|
|
|
using namespace std;
|
|
|
|
// looping over c style strings in order to make text more sarcastic
|
|
|
|
void makeSarcastic(char str[]){
|
|
int i = 0;
|
|
bool upper = false;
|
|
while(str[i] != '\0'){
|
|
if(upper){
|
|
str[i] = toupper(str[i]);
|
|
}
|
|
else{
|
|
str[i] = tolower(str[i]);
|
|
}
|
|
upper = !upper;
|
|
i = i + 1;
|
|
}
|
|
}
|
|
|
|
int main(){
|
|
char msg[100];
|
|
|
|
cout << "Enter text to be made more sarcastic: " << endl;
|
|
cin.getline(msg,100);
|
|
|
|
makeSarcastic(msg);
|
|
|
|
cout << msg << endl;
|
|
|
|
return 0;
|
|
}
|