Hello, I have this program that runs in C++ that I need to run in C.
This is my program in C++:
#include <iostream>
#include <string>
#include <cctype>
using namespace std;
char encode (char plaintext) {
if (isupper(plaintext)) {
if (plaintext > 'M') {
plaintext += 13;
}
else {
plaintext -= 13;
}
}
else if (islower(plaintext)) {
if (plaintext > 'm') {
plaintext +=13;
}
else {
plaintext -=13;
}
}
return (plaintext);
}
int main() {
cout << "Input string: ";
string str;
getline (cin, str);
for (int i=0; i<string.length();i++) {
cout << encode(str[i]);
}
cout << "\nPress any <ENTER> to exit";
cin.get();
return 0;
}
Help would be greatly appreciated