Array Changing Program. Suggestions or ideas please! Help?

I need a program that allows user to change the array of text by entering a single character like 'c' as the first input. Followed by the total number of text lines to be inputted into the array and then the text lines themselves.

Here is the array of text and beginning of the program

#include <iostream>
#include <iomanip>
#include <cstring>
#include <string>
using namespace std;
#define K 2000

void main(){

char array2[z]={"A gentle, dull flickering flame, burns in the marble hearth.\ 
Its dim light scarcely illuminates the small, cozy room with its\ 
 The dismal light plays softly causing shadows over the solitary \
figure of a wooden desk at which Allen was roaming through his \
memories. Thinking back in the past where he once had a\ 
friendship which was out righteously incredible. \
She was the girl of his dreams, in a way which she \
had everything he had ever sought out in a beautiful and clever girl.\
 Most of all she had his heart. Her style was incredible in the way\
 the outfits she would wear would match perfectly\ 
giving a deep vibrant lively feeling."};

Any Ideas Or Suggestions as how i can do so?
Last edited on
say the user inputs
c 6

Thus is allowed to change the existing characters of array by inputting after
Twinkle Twinkle little star,
How I wonder what you are,
 Up above the world so high,
Like a diamond in the sky,
Twinkle twinkle little star,
How I wonder what you are!
Last edited on
Why does no one ever wanna help me. haii...
Read the string into a 2 dimensional array of chars. Then use a pointer to run through the particular rows of characters replacing the characters with the input.

first find the longest line of text characters that will be the width +1 for a terminating null of each line and use the \ character as a marker to jump into the next line of the array when reading the current text in as well as checking for the max size of the longest line. Initialize the array with null characters. So as not to get any strange character appearing from what the allocated memory once had.

What is the c supposed to represent?
What is the meaning of #define K 2000? Why is that there?
Also when replacing the characters. is it supposed to replace everything in the line or just the characters it writes over and where is it designated to start?
Last edited on
Topic archived. No new replies allowed.