Trusted by Students Everywhere
Why Choose Us?
0% AI Guarantee

Human-written only.

24/7 Support

Anytime, anywhere.

Plagiarism Free

100% Original.

Expert Tutors

Masters & PhDs.

100% Confidential

Your privacy matters.

On-Time Delivery

Never miss a deadline.

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

Civil Engineering May 20, 2021

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.

Expert Solution

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;
    }
}

Archived Solution
Unlocked Solution

You have full access to this solution. To save a copy with all formatting and attachments, use the button below.

Already a member? Sign In
Important Note: This solution is from our archive and has been purchased by others. Submitting it as-is may trigger plagiarism detection. Use it for reference only.

For ready-to-submit work, please order a fresh solution below.

Or get 100% fresh solution
Get Custom Quote
Secure Payment