Answer to Question #349384 in C++ for vince

Question #349384
  1. In the code editor, you are provided with a main() function that asks the user for an integer and passes the address of this integer to a function call of the simple() function.
  2. This simple() function hasn't been implemented yet so your task is just that, to implement it. This has the following description:
  3. Return type - void
  4. Name - simple
  5. Parameter - address of an integer
  6. Description - prints a line of asterisks
  7. DO NOT EDIT THE MAIN FUNCTION

Input


1. An integer

Output


Enter·n:·5
*****

#include <iostream>

using namespace std;


int main(void) {

  int n;


  cout << "Enter n: ";

  cin >> n;


  simple(&n);

  

 cout << n;


  return 0;

}


1
Expert's answer
2022-06-10T18:34:26-0400
#include <iostream>
using namespace std;
void simple(int *n){

    while(*n!=0) {
        cout<<'*';
        (*n)--;
    }
}
int main(void) {
  int n;
  cout << "Enter n: ";
  cin >> n;
  simple(&n);
 
  cout << '\n';

  return 0;

}




Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
New on Blog
APPROVED BY CLIENTS