Sometimes, storing an image is easier if you store the steps taken to draw the image rather than the image itself. In such a situation, a sequence of directed lines are concatenated, or attached to one another, to form the image. For example, a simple drawing program might allow eight simple directions of movement:

8 1 2

7 3


6 5 4
[The arrows didn't copy but the (4-8)(6-2)diagonals and (7-3)horizontal, (5-1)vertical lines]
For this example, a “picture” composed of the sequence “1, 3, 4, 3” would draw a line segment up, to the right, down on an angle, then right again.

Develop a program to take an encoding sequence of numbers and create a drawing based on the sequence, using the arrow directions displayed in the first figure. Your program must use the text screen for the drawing surface and must allow for a figure up to 20 characters tall and 70 characters wide. Your drawings on this grid should be made with the asterisk (*) character. Each drawing must start in the lower-left corner and if a command would have the figure move “off the page,” the program must ignore that command and proceed on to the next command in the sequence.

Each encoded sequence entered will be a list of numbers, positive and/or negative, ending with a 0 as the indicator that the drawing is finished. If the number is negative, you must move in the direction you would if the value were positive, but you do not put an asterisk in the position when done moving. Sequences may be of any length. After inputting the zero value, your program will display the final image.

To get full credit on this assignment you must use a class and objects for image processing. You must use an array to store and print the character sequence onto the screen. (A 2 dimensional array would be ideal.) Please do as much code as you can in your class and leave main() as small as possible. You should have a 2 dimensional array inside of your class along with some sort of int values for the x and y coordinates to keep track of what array elements you are going to store the user inputted image.

Sample Run:
Enter drawing sequence below.

1 1 1 2 2 4 4 5 5 7 7 7 0

Your picture:

*
* *
* *
* *
*****


------------------------------------------------------------------------------

so this assignment is a bit weird to me, I would like to know how to make the grid for the commands to navigate the "draw" part.


I get an awesome grade in this course thus far. I just need help starting off.

Are we going to be making the grid in an class/object
and draw navigation be another object.
Usually I make a flowchart for my programs and it doesn't seem that I can figure out how to do this that way.

/******************************************************************************
* Program:
* Programmer: Christina Backlund
* Date : 
* Purpose:
* notes:
*******************************************************************************/
/*
You MUST submit your work by email to cpolen@shastacollege.edu by the due date. 
Late assignments are NOT accepted after the due date. You may turn in your assignment as early as you would like.

Sometimes, storing an image is easier if you store the steps taken to draw the
image rather than the image itself. In such a situation, a sequence of directed
lines are concatenated, or attached to one another, to form the image. 
For example, a simple drawing program might allow eight simple directions of movement:

8  1  2
\ | /
\|/
7-----------3
/|\
/ | \
6  5  4

For this example, a “picture” composed of the sequence “1, 3, 4, 3” would draw a line segment up,
to the right, down on an angle, then right again.
*

Develop a program to take an encoding sequence of numbers and create a drawing based on the
sequence, using the arrow directions displayed in the first figure. Your program must use the
text screen for the drawing surface and must allow for a figure up to 20 characters tall and 70 characters wide. 
Your drawings on this grid should be made with the asterisk (*) character. Each drawing must start in the 
lower-left corner and if a command would have the figure move “off the page,” the program must ignore that
command and proceed on to the next command in the sequence.

Each encoded sequence entered will be a list of numbers, positive and/or negative,
ending with a 0 as the indicator that the drawing is finished. If the number is
negative, you must move in the direction you would if the value were positive,
but you do not put an asterisk in the position when done moving.
Sequences may be of any length. After inputting the zero value, your program will display the final image. 

To get full credit on this assignment you must use a class and objects for image processing.
You must use an array to store and print the character sequence onto the screen. 
(A 2 dimensional array would be ideal.) Please do as much code as you can in your class and leave main()
as small as possible. You should have a 2 dimensional array inside of your class along with some sort of
int values for the x and y coordinates to keep track of what array elements you are going to store the user inputted image.

Sample Run: 
Enter drawing sequence below.

1 1 1 2 2 4 4 5 5 7 7 7 0

Your picture:

*
* *
*   *
*   *

*/
//______________________________________________________________________________
//-----------------------------headers------------------------------------------
#include<iostream>// for cin and cout msg display.
using namespace std;
//______________________________________________________________________________
//-----------------------------Global Variables---------------------------------
//______________________________________________________________________________
//-----------------------------Classes------------------------------------------
///////////////////////////////////////////////////////////////////////////////
// Class Board for making the two dimensional array to draw in.
//".... 20 characters tall and 70 characters wide."
class board
{
private:
	int x;
	int y;
	// or would it be char as the array values since '#' is a char not int value?

public:

};
///////////////////////////////////////////////////////////////////////////////
// class draw
class draw
{
private:

public:
	board grid[70][20];//creates the board that is 70 x 20; must assign values to the grid. so character pen would move.


	draw ()                 //constructor (no args)
	{  }
	void move()
	{      } 
};
//Class Functions
//void draw::move()
// need to set starting point at bottom/left corner of screen.
//code for out of bounds movement.


///////////////////////////////////////////////////////////////////////////////
//______________________________________________________________________________
//----------------------------Functions----------------------------------------

/******************************************************************************
Function main()
parameters: n/a (null)
purpose: to start the program and call classes and class functions.
must be as small as it can be.
******************************************************************************/
int main()
{
	cout<<"main()"<<endl;
	cout<<":Image Processing with ASCII Character '#':\nDirection values:"<<endl;
	cout<<"   8  1  2"<<endl;
	cout<<"    \\ | /"<<endl;
	cout<<"     \\|/"<<endl;
	cout<<"7-----------3"<<endl;
	cout<<"     /|\\"<<endl;
	cout<<"    / | \\"<<endl;
	cout<<"   6  5  4"<<endl;

	// create a board to draw in 
	// have user input direction to draw to
	// have code that loops through the user's string of numbers to draw ACSII Characters
	//chosen character is '#' because it fills more of the box space in the array


	system("pause");
	return 0;
}




/******************************************************************************
Function:
parameters:
purpose: 
******************************************************************************/
//______________________________________________________________________________
/******************************************************************************
* Program:
* Programmer: Christina Backlund
* Date : 
* Purpose:
* notes:
*******************************************************************************/
/*
You MUST submit your work by email to cpolen@shastacollege.edu by the due date. 
Late assignments are NOT accepted after the due date. You may turn in your assignment as early as you would like.

Sometimes, storing an image is easier if you store the steps taken to draw the
image rather than the image itself. In such a situation, a sequence of directed
lines are concatenated, or attached to one another, to form the image. 
For example, a simple drawing program might allow eight simple directions of movement:

8  1  2
\ | /
\|/
7-----------3
/|\
/ | \
6  5  4

For this example, a “picture” composed of the sequence “1, 3, 4, 3” would draw a line segment up,
to the right, down on an angle, then right again.
*

Develop a program to take an encoding sequence of numbers and create a drawing based on the
sequence, using the arrow directions displayed in the first figure. Your program must use the
text screen for the drawing surface and must allow for a figure up to 20 characters tall and 70 characters wide. 
Your drawings on this grid should be made with the asterisk (*) character. Each drawing must start in the 
lower-left corner and if a command would have the figure move “off the page,” the program must ignore that
command and proceed on to the next command in the sequence.

Each encoded sequence entered will be a list of numbers, positive and/or negative,
ending with a 0 as the indicator that the drawing is finished. If the number is
negative, you must move in the direction you would if the value were positive,
but you do not put an asterisk in the position when done moving.
Sequences may be of any length. After inputting the zero value, your program will display the final image. 

To get full credit on this assignment you must use a class and objects for image processing.
You must use an array to store and print the character sequence onto the screen. 
(A 2 dimensional array would be ideal.) Please do as much code as you can in your class and leave main()
as small as possible. You should have a 2 dimensional array inside of your class along with some sort of
int values for the x and y coordinates to keep track of what array elements you are going to store the user inputted image.

Sample Run: 
Enter drawing sequence below.

1 1 1 2 2 4 4 5 5 7 7 7 0

Your picture:

*
* *
*   *
*   *
___________________________________________________________________
It is easier if you have one class, say draw and put the x and y in your draw class.

In your draw class you will have a initialize picture function that sets all array elements of your 
"board grid" (you can't have a space in the name.) to a space ( ' ' ).
You will have another function say printPic that prints all the array elements of your 
"board grid". Lastly at least one more function for getting the users input and processing the picture.
____________________________________________________________________

*/
//______________________________________________________________________________
//-----------------------------headers------------------------------------------
#include<iostream>// for cin and cout msg display.
using namespace std;
//______________________________________________________________________________
//-----------------------------Global Variables---------------------------------
//______________________________________________________________________________
//-----------------------------Classes------------------------------------------
///////////////////////////////////////////////////////////////////////////////
// Class Board for making the two dimensional array to draw in.
//".... 20 characters tall and 70 characters wide."
class draw
{
private:
	int x;
	int y;
	// or would it be char as the array values since '#' is a char not int value?
	int grid[70][20];//creates the board that is 70 x 20; must assign values to the grid. so character pen would move.
public:
	
	draw ()  //constructor (no args)
	{  }
	void printPic();
	void move()
	{      } 
};
//Class Functions
//void draw::print
//void board::printPic()
//{
//}

void print(int grid[][]) 
{ 
	for(x = 0; x < 70; x++) 
	{ 
		for(y = 0; y < 20; y++) 
			cout << " " << grid[x][y];
		cout << endl; 
	} 
}

// need to set starting point at bottom/left corner of screen.
//code for out of bounds movement.


///////////////////////////////////////////////////////////////////////////////
//______________________________________________________________________________
//----------------------------Functions----------------------------------------

/******************************************************************************
Function main()
parameters: n/a (null)
purpose: to start the program and call classes and class functions.
must be as small as it can be.
******************************************************************************/
int main()
{
	cout<<"main()"<<endl;
	cout<<":Image Processing with ASCII Character '#':\nDirection values:"<<endl;
	cout<<"   8  1  2"<<endl;
	cout<<"    \\ | /"<<endl;
	cout<<"     \\|/"<<endl;
	cout<<"7-----------3"<<endl;
	cout<<"     /|\\"<<endl;
	cout<<"    / | \\"<<endl;
	cout<<"   6  5  4"<<endl;
	draw::printPic();

	// create a board to draw in 
	// have user input direction to draw to
	// have code that loops through the user's string of numbers to draw ACSII Characters
	//chosen character is '#' because it fills more of the box space in the array


	system("pause");
	return 0;
}




/******************************************************************************
Function:
parameters:
purpose: 
******************************************************************************/
//______________________________________________________________________________

C++ Ascii Drawing With String Of *

/******************************************************************************
* Program:
* Programmer: Christina Backlund
* Date : 
* Purpose:
* notes:
*******************************************************************************/
/*
You MUST submit your work by email to cpolen@shastacollege.edu by the due date. 
Late assignments are NOT accepted after the due date. You may turn in your assignment as early as you would like.

Sometimes, storing an image is easier if you store the steps taken to draw the
image rather than the image itself. In such a situation, a sequence of directed
lines are concatenated, or attached to one another, to form the image. 
For example, a simple drawing program might allow eight simple directions of movement:

8  1  2
\ | /
\|/
7-----------3
/|\
/ | \
6  5  4

For this example, a “picture” composed of the sequence “1, 3, 4, 3” would draw a line segment up,
to the right, down on an angle, then right again.
*

Develop a program to take an encoding sequence of numbers and create a drawing based on the
sequence, using the arrow directions displayed in the first figure. Your program must use the
text screen for the drawing surface and must allow for a figure up to 20 characters tall and 70 characters wide. 
Your drawings on this grid should be made with the asterisk (*) character. Each drawing must start in the 
lower-left corner and if a command would have the figure move “off the page,” the program must ignore that
command and proceed on to the next command in the sequence.

Each encoded sequence entered will be a list of numbers, positive and/or negative,
ending with a 0 as the indicator that the drawing is finished. If the number is
negative, you must move in the direction you would if the value were positive,
but you do not put an asterisk in the position when done moving.
Sequences may be of any length. After inputting the zero value, your program will display the final image. 

To get full credit on this assignment you must use a class and objects for image processing.
You must use an array to store and print the character sequence onto the screen. 
(A 2 dimensional array would be ideal.) Please do as much code as you can in your class and leave main()
as small as possible. You should have a 2 dimensional array inside of your class along with some sort of
int values for the x and y coordinates to keep track of what array elements you are going to store the user inputted image.

Sample Run: 
Enter drawing sequence below.

1 1 1 2 2 4 4 5 5 7 7 7 0

Your picture:

*
* *
*   *
*   *
___________________________________________________________________
It is easier if you have one class, say draw and put the x and y in your draw class.

In your draw class you will have a initialize picture function that sets all array elements of your 
"board grid" (you can't have a space in the name.) to a space ( ' ' ).
You will have another function say printPic that prints all the array elements of your 
"board grid". Lastly at least one more function for getting the users input and processing the picture.
____________________________________________________________________

*/
//______________________________________________________________________________
//-----------------------------headers------------------------------------------
#include<iostream>// for cin and cout msg display.

#include <string.h>
#include <stdlib.h>
using namespace std;
//______________________________________________________________________________
//-----------------------------Global Variables---------------------------------
//______________________________________________________________________________
//-----------------------------Classes------------------------------------------
///////////////////////////////////////////////////////////////////////////////
// Class Board for making the two dimensional array to draw in.
//".... 20 characters tall and 70 characters wide."
class draw
{
private:
	int x;
	int y;
	// or would it be char as the array values since '#' is a char not int value?

public:
	int i,j;
	int grid[70][20];//creates the board that is 70 x 20; must assign values to the grid. so character pen would move.
	draw ()  //constructor (no args)
	{  }
	void drawchar();
	void printPic(int grid[][20]);
	void read(int grid[][20]);
	void move()
	{      } 
};
//Class Functions
//void draw::print
//void board::printPic()
//{
//}
void draw::read(int grid[][20])
{
	cout <<"read";
	for(i = 0; i < 70; i++)
	{
		cout <<"row " << i << ": ";
		for(j = 0; j < 20; j++)
		{
			cin >> grid[i][j];
		}
	}
}


void draw::printPic(int grid[][20]) 
{ 

	for(i = 0; i < 70; i++) 
	{ 
		for(j = 0; j < 20; j++) 
			cout << " " << grid[i][j];
		cout << endl; 
	} 
}
void draw::drawchar()
{


        string str; //String
        int a; //Number of letters

        cout<<"Enter string : ";   /*Inputs the characters*/
        cin>>str;

        for(a = 0; a!=str.length(); ++a) /*Prints out each letter converted into a int value.*/
        cout<<int(str[a])<<", ";

        system("PAUSE");
        return 0;

}

}


// need to set starting point at bottom/left corner of screen.
//code for out of bounds movement.


///////////////////////////////////////////////////////////////////////////////
//______________________________________________________________________________
//----------------------------Functions----------------------------------------

/******************************************************************************
Function main()
parameters: n/a (null)
purpose: to start the program and call classes and class functions.
must be as small as it can be.
******************************************************************************/
int main()
{
	cout<<"main()"<<endl;
	cout<<":Image Processing with ASCII Character '#':\nDirection values:"<<endl;
	cout<<"   8  1  2"<<endl;
	cout<<"    \\ | /"<<endl;
	cout<<"     \\|/"<<endl;
	cout<<"7-----------3"<<endl;
	cout<<"     /|\\"<<endl;
	cout<<"    / | \\"<<endl;
	cout<<"   6  5  4"<<endl;
	draw board; // creates the game()
	board.read(); 
	board.printPic();

	// create a board to draw in 
	// have user input direction to draw to
	// have code that loops through the user's string of numbers to draw ACSII Characters
	//chosen character is '#' because it fills more of the box space in the array


	system("pause");
	return 0;
}




/******************************************************************************
Function:
parameters:
purpose: 
******************************************************************************/
//______________________________________________________________________________

I need a 2d array of 20X70
the curser needs to be at the last row, first column.... Lower left hand part of the drawing screen. I got a class going on with some class functions that need to be called by main, but my problem is I am having trouble trying to figure out the way to display this table. and set the first drawing point to the bottom left hand corner.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.