Fill This Form To Receive Instant Help

Help in Homework
trustpilot ratings
google ratings


Homework answers / question archive / Write the definition of a function dashedLine , with one parameter, an int

Write the definition of a function dashedLine , with one parameter, an int

Civil Engineering

Write the definition of a function dashedLine , with one parameter, an int .
If the parameter is negative or zero, the function does nothing. Otherwise it prints a complete line terminated by a new line character to standard output consisting of dashes (hyphens) with the parameter's value determining the number of dashes. The function returns nothing.

pur-new-sol

Purchase A New Answer

Custom new solution created by our subject matter experts

GET A QUOTE

Answer Preview

Answer:

#import <iostream>
using namespace std;
void dashedLine(int);
int main()
{dashedLine(8);
dashedLine(0);
dashedLine(15);
dashedLine(-12);
system("pause");
return 0;
}
void dashedLine(int dashes)
{int i;
if(dashes>0)
    {for(i=0;i<dashes;i++)
        cout<<"-";
    cout<<endl;
    }
}

Related Questions