Are you "allowed" to use the functions contained in <cstring>
? Everything you need is within that header.
yeah i am supposed to use <cstring>
i need help implementing the options for the user to enter to work on the string
Last edited on
how do i implement this with what i currently have ? i am still having a hard time with this assignment..
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41
|
#include <iostream>
#include <cstring>
using namespace std;
int main()
{
char a_string[80];
cout << "Enter A String:\n";
cin.getline(a_string,80);
cout << " " << endl;
cout << "Current String: " << a_string << endl;
cout << " " << endl;
cout << "Choose An Option: " << endl;
cout << "s-search" <<endl;
cout << "i-insert" <<endl;
cout << "a-append" << endl;
cout << "d-delete" << endl;
cout << "r-replace" << endl;
cout << "e-exit" << endl;
bool running = true;
while ( running )
{
char choice;
std::cin >> choice; std::cin.ignore( 80, '\n' );
switch( choice )
{
case 'e': running = false; break;
default:
}
}
}
|
Last edited on