Hi, I need help with my program. It needs to use pointers and meet the following criteria...having the user input a 12 character word. Store this word in a char*. Next ask the user for an integer.
Manipulate the char* to shift the word to the left by the integer amount:
#include <iostream>
usingnamespace std;
int main ()
{
int n;
int number [n];
char * word;
cout << "Please enter a 12 letter word" << endl;
cin >> word;
cout << "Please Enter an integer" << endl;
cin >> n;
word[n] = 0;
word--;
return 0;
Thank you
}
#include <iostream>
usingnamespace std;
int main ()
{
int n;
int number [n];
char * word;
char word [word];
cout << "Please enter a 12 letter word" << endl;
cin >> word;
cout << "Please Enter an integer" << endl;
cin >> n;
word[n] = 0;
word--;
return 0;
}
Not really. For starters, you're using the identifier "word" for two different objects, and you're apparently trying to use a pointer as the size of an array.