How JustAnswer Works:
  • Ask an Expert
    Experts are full of valuable knowledge and are ready to help with any question. Credentials confirmed by a Fortune 500 verification firm.
  • Get a Professional Answer
    Via email, text message, or notification as you wait on our site. Ask follow up questions if you need to.
  • 100% Satisfaction Guarantee
    Rate the answer you receive.
Ask ATLPROG Your Own Question
ATLPROG
ATLPROG, Computer Software Engineer
Category: Programming
Satisfied Customers: 7677
Experience:  MS in IT.Several years of programming experience in Java C++ C C# Python VB Javascript HTML
44910485
Type Your Programming Question Here...
ATLPROG is online now
A new question is answered every 9 seconds

Write a recursive function drawPattern(int width,int

Customer Question

write a recursive function drawPattern(int width,int startcol); this function should produce output
example
drawPattern(2,0);
Output:
**
*
*
*
*
**
function calls:
drawPattern(2,0);
drawPattern(1,0);
drawPattern(1,0);
drawPattern(1,1);
drawPattern(1,1);
drawPattern(2,0);
----------
drawPattern(4,0);
Output:
****
**
*
*
*
*
**
**
*
*
*
*
**
****
Function calls
drawpattern(4,0);
drawpattern(2,0);
drawpattern(1,0);
drawpattern(1,0);
drawpattern(1,1);
drawpattern(1,1);
drawpattern(2,0);
drawpattern(2,2);
drawpattern(1,2);
drawpattern(1,2);
drawpattern(1,3);
drawpattern(1,3);
drawpattern(2,2);
drawpattern(4,0);
Submitted: 1 year ago.
Category: Programming
Expert:  ATLPROG replied 1 year ago.

Hello i can help.

Expert:  ATLPROG replied 1 year ago.

Can you please upload what you get in a word doc on wikisend.com and post file id here

Customer: replied 1 year ago.
include // Input/Ouput Stream header
using std::cin; //standard input stream
using std::endl; // flushes the output buffer and moves cursor to next line
using std::cout; // specifically the cout object
// cout is short for console output
// console is another name for screen
#include // using power functionvoid drawForest(int size); // prototype of function/**
* pattern
*
* @remarks it is a recursively constructed function to draw Forest
*
*
* Input: N/A
*
* Output: Drawing on the screen
*
*/
void drawForest(int size)
{
if (size == 1)
{
for (int k = 0; k < size; k ++)
cout<< "-" ;
for (int k = 0; k < size; k ++)
cout<< "-" ;
cout << "*" ;
cout<< endl;
}
else
{
drawForest (size / 2);
for (int k = 0; k < size; k ++)
cout << "-";
for (int k = 0; k < size; k ++)
cout << "-";
cout << "*" ;
cout<< endl;
drawForest (size / 2);
}
return;
}int main()
{
int size;
cout << "enter size : " << endl;
cin >> size;
drawForest (size);
return 0;
}
Customer: replied 1 year ago.
Not that. 'm sending the code now
Customer: replied 1 year ago.
include
using namespace std;void drawpattern(int width, int startcol);
void printStar(int width,int startcol);int main()
{
drawpattern(2, 0);
return 0;
}void printStar(int width, int startcol)
{
if(startcol==0)
{
if(width==0)
{
cout<<endl;return;
//finished drawing the pattern, so printing a newline and exiting the function
}
else
{
cout<<"*";
printStar(width-1,startcol);
//number of * required, are not printed yet, so printing a *, and calling the
//function recursively, with one less * count
}
}
else
{
cout<<" ";
printStar(width,startcol-1);
//number of spaces required, are not printed yet, so printing a space, and calling the
//function recursively, with one less space count
}}
void drawpattern(int width, int startcol)
{
if(width %2 == 0)
{
printStar(width,startcol);
drawpattern(width-1,startcol);
}
else
{
drawpattern(width-1,startcol);
}
}
Expert:  ATLPROG replied 1 year ago.

the code is not readable.

Can you please go to www.wikisend.com and upload your file ? Once you do that you will get a page that has the "File ID" and "Download Link". Copy the "Download Link" or "File ID" and please paste it in your reply here.

Customer: replied 1 year ago.
there was error in uploading file
Expert:  ATLPROG replied 1 year ago.

Can you please go to www.mediafire.com and upload your file ? Once you do that you will get a page that has the "Download Link". Copy the "Download Link" and please paste it in your reply here.

Customer: replied 1 year ago.
https://www.mediafire.com/?edlmyr23cnljz6j
Expert:  ATLPROG replied 1 year ago.

canyou upload the exact question too

Customer: replied 1 year ago.
https://www.mediafire.com/?25w5wkfsvbnz4b6
Expert:  ATLPROG replied 1 year ago.

by when you need this done?

Customer: replied 1 year ago.
Midnight?
Customer: replied 1 year ago.
11:50 PM Central Standard Time.
Expert:  ATLPROG replied 1 year ago.

Sorry i will have to opt out

Customer: replied 1 year ago.
i have created the function for the printing stars but i have to call recursive method for drawPattern(width,startCol);
Expert:  LogicPro replied 1 year ago.

Hi,

Welcome

Hope you are doing well.

My name is ***** ***** I will help you

Zip all files; upload the zipped file to http://wikisend.com or http://ge.tt and post download link here.

Customer: replied 1 year ago.
http://www.mediafire.com/view/edlmyr23cnljz6j/sp12hw1_Graded.cpp
http://www.mediafire.com/view/25w5wkfsvbnz4b6/Homework2_-_A-State_Computer_Science_Wiki.pdf
Expert:  LogicPro replied 1 year ago.

let me review, please wait

Customer: replied 1 year ago.
Okay
Expert:  LogicPro replied 1 year ago.

thanks

Expert:  LogicPro replied 1 year ago.

It will take time. I am opting out for others to answer. You will get email once you get a reply

Expert:  Zabo04 replied 1 year ago.

I am working on a solution for you now.

Customer: replied 1 year ago.
No, I have reached my deadline
Customer: replied 1 year ago.
This won't work with me now
Customer: replied 1 year ago.
Kindly, refund my money
Expert:  Zabo04 replied 1 year ago.

I am an expert, so a site user like yourself. You have to e-mail JustAnswer directly.

Expert:  Zabo04 replied 1 year ago.

I know how deadlines work, and I'm sorry about this, so I am attaching the solution in a .txt file (just change the extension to .cpp to run). I know you plan to request a refund, if you do not want to pay, do not rate me and contact JustAnswer. I would just like you to know that you can get good answers here and hope you will come back so I want you to see that I do have a working answer to your question.

Customer: replied 1 year ago.
Sorry, i no longer need the solution after deadline.
Customer: replied 1 year ago.
I have already submitted my partially executed code. I'm not satisfied. Thanks