printing arrays or pointers

Hi guys I this assignment for a C++ course in University

The assignment says Write a program that asks user to enter a number then draws that many x characters on screen, on the same line, at random locations between 0 and 50. The program then uses left and right arrow keys to change the location of x characters and draw them again on the next line. The program end if the user enters Escape.

I am a programming noob and there are some things I dont quite grasp yet

I understand how to make dynamic arrays and what not but dont understand how to approach this


 

}
What have you got till now.
It is easier to help if you ask a more specific question.
Get the user input of the arrow keys?
Correct me if I am wrong, but is that not quite advanced?

#include "stdio.h"

#include "stdlib.h"

void main()

{
int i;
int xnum;

printf("enter number of x's: ");

scanf("%d",&xnum);
int* size = (int*)malloc(xnum*4);
for(i=0; i < xnum; i++)
{
size[i] = (rand()%51);
printf("%d ", size[i]);
}


}

basically all I have done is make the array of random numbers based on the number that the user input.

I am mainly confused about how to set up each line. Prof said to think of each line as an array of 50 spaces (does this mean that each line should be set up as a static array of 50 like line[50]) but then how do I make the program recognize to write an x at each space where the random value generated in size[i] is equal to the number in line[]. Because later on these characters are going to have to move left to right by one space later on in the program, how will I be able to add or subtract a space char to do so later on?
Topic archived. No new replies allowed.