I just finished this a while ago. I'm sure I've made plenty of errors, but It gets the job done. Any suggestions on how I could "optimize" the code, to make it look prettier? I think I made some statements that really had no affect on the program itself :(
#include <iostream>
#include <string>
#include <stdio.h>
#include <string.h>
char STOP[265];
usingnamespace std;
int main (void)
{
cout << "Enter the string to be reversed...\n";
cin.getline(STOP,265);
int c = strlen(STOP) ;
for (; c >= 0; c--)
{
cout << STOP[c];
}
return 0;
}
So, any suggestions on what I could've done better? Thanks.
#include <iostream>
#include <string>
#include <string.h>
char STOP[265];
usingnamespace std;
int main (void)
{
cout << "Enter the string to be reversed...\n";
cin.getline(STOP,265);
int c = strlen(STOP) - 1;
for (; c >= 0; c--)
{
cout << STOP[c];
}
return 0;
}