Question: IM HAVING AN ISSUE WITH BUFFER OVERFLOW USING ECLIPSE C++ INTERFACE ,,, here is the code to get user input and reverse the string but

IM HAVING AN ISSUE WITH BUFFER OVERFLOW USING ECLIPSE C++ INTERFACE ,,, here is the code to get user input and reverse the string but if i enter more than 14 characters I have an issue with my program.. any help appreciated

/* * ReversedStrings.cpp * * Created on: Sep 25, 2018 * Author: malek */

#include #include using namespace std; int main(void) { char str[15], temp, cSel; int i, j; do {

cout << "Enter a string : "; cin.getline(str,14);

j = strlen(str) - 1; for (i = 0; i < j; i++,j--) { temp = str[i]; str[i] = str[j]; str[j] = temp; } cout << " Reverse string : " << str << endl; cout <<" "; cout <<"Would you like to enter another String? Enter Y to Continue or press X to exit."<>cSel; switch (cSel) { case 'Y':cout <<"You selected to enter another string"<

} while (cSel != 'X');

return 0; }

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!