how to make scrolling wrap-around effect for my code?

I am having problem in scrolling my code from left to right, upward and downward.I am written my code as followed:

#include <iostream>
#include <cstdlib>
#include <string>
#include <cstring>
#include <stdlib.h>

using namespace std ;



void display(string letter)
{
const int dimI = 20, dimJ = 40;
char board_A[dimI][dimJ] =
{
{' ' , ' ' , '#' , ' ' , ' ' },
{' ' , '#' , ' ' , '#' , ' ' },
{'#' , ' ' , ' ' , ' ' , '#' },
{'#' , ' ' , ' ' , ' ' , '#' },
{'#' , '#' , '#' , '#' , '#' },
{'#' , ' ' , ' ' , ' ' , '#' },
{'#' , ' ' , ' ' ,' ' , '#' }
};

char board_B[dimI][dimJ] =
{
{'#' , '#' , '#' , '#' , ' ' },
{'#' , ' ' , ' ' , ' ' , '#' },
{'#' , ' ' , ' ' , ' ' , '#' },
{'#' , '#' , '#' , '#' , ' ' },
{'#' , ' ' , ' ' , ' ' , '#' },
{'#' , ' ' , ' ' , ' ' , '#' },
{'#' , '#' , '#' ,'#' , ' ' }
};



int main()
{

string letter ;

string displayboard(int dimI , int dimJ, const char A[20][40]) ;

cout << "Please enter a word or numbers:";
getline(cin, letter);
display( letter);



}
Last edited on
you cannot move the cursor around in text that was already typed in pure c++. Is that what you are trying to do? There are external libraries that can do this, if that is what you are asking (unclear).
I was told by my friend that using temp can allow my code to scroll.For example, if i input string AABBA, then the output will be AABBA scrolling to the left or right or unward and downward.
Is it possible that using temp can allow me to swap the position and move the string?
Solid information about your OS/Compiler might help provide you with more concrete information.


Perhaps you can start with
 
char screen[25][80];


Then you could do something like copy char board_A to say a point in screen such as 10,10.
You then draw the whole screen array to the physical screen.

Then you clear screen (both the physical screen and the in-memory array), and then copy board_A to say 10,11
You then draw the whole screen array to the physical screen, and voila, it's scrolled!.
your friend's words and your code are not matching at all. your code writes a constant block of stuff, the input is ignored, you don't use letter anywhere after you read it in.
Topic archived. No new replies allowed.