1.Write a C++ function that intakes 2 arguments: a character and an integer and prints the character given number of times.If ,however, the integer is missing the function prints the character twice.

First off, we don't do other people's homework for them. Second, we don't do other people's homework for them. And third, we don't do other people's homework for them. Sensing a pattern here yet?

No one here will simply hand you a solution on a silver platter. If you show us what you've done, what you've tried to do, and what problems you've had with it, then we'll be happy to help. If you have specific questions, we can answer them, or at least point you in the right direction. If you have a program with a bug you can't swat on your own, we'll be glad to assist, so long as you pay attention to the forum rules and post sensible questions in an intelligent manner that we have some reasonable hope of answering.

But just cutting and pasting an assignment into a message, without even prefacing it with something like, "I have this homework problem that I can't solve...", is likely to get you booted from the message boards here and elsewhere - if you're lucky. What happens to you if you are unlucky is... well... let's just say that this guy probably won't be trying that again, on that forum or this one.

We take this issue seriously here. Very seriously. Asking us to do homework for you is a grave breach of academic ethics on your part, and actually doing so would be an even bigger breach on ours (not that this stops the many fine mercenaries at vWorker and Scriptlance, but still). Simply posting this here, in this way, could get you expelled from your school, if someone happens to notice it and blow the whistle on you. Furthermore, it does neither you nor us any good to help you cheat - especially since there's a good chance some day one of us will have to work with you, manage you, or, Eris forefend, fix code you've written. We have an obligation to our profession and our own future sanity to help you become a good programmer, and doing your coursework for you isn't going to do that.

And please don't insult our intelligence by claiming that it isn't a class assignment. It's very easy to spot one, and we have a lot of practice at it. Trust me on this.

Now, if you actually don't know how to create a program that fits the requirements... hmmmn. Reading the book is definitely called for. As is speaking to the professor; while some can be a**holes about office hours, most are more than willing to give extra help, if only to keep their class grades from slipping to the point where they get re-assigned to teach remedial basketweaving.

Still, in this case, it shouldn't require even that much work: this is about as simple as a C++ assignment gets. Seriously, if you cannot complete this assignment yourself in about five minutes, you're in the wrong course of study.

1.Write a C++ function that intakes 2 arguments: a character and an integer and prints the character given number of times.If ,however, the integer is missing the function prints the character twice.

Do you know how to write a for loop? Write one that uses a range of [0, counter). Then, put an output statement in the loop. Then put the loop in a function that contains 2 arguments.

Really not that difficult. You have a basic synopsis of the algorithm, now go write your own code. We're NOT rent-a-coders.

I got the same question in a PM, which I promptly just deleted.

#include <iostream>

using namespace std;

int main()
	int i;
	char ch;
	cout<<"Number ";
	for(int j = 0 ; j < i; j++)
    return 0;
commented: You've been around long enough, and have enough posts. You should know better by now. -3

Im kinda new here @! so please can you help me find out what my mistake here in this program is??
PROGRAM - WRITE A PROGRAM TO MAKE A GUESSING GAME ie (0-5) ( 5-10) etc to generate random nos b/w (0-50)

  {#include <iostream>
using namespace std ;
int main ()

int n,x;
randomize ();
cout<<"number b/w 0-50\n";
for (int i=3;i>0;i--)
                { x=random(51);
                   if ( x==n)
                   cout ++; break;
               cout<<"play again? (0-stop)\n;" ;
               int opt;
               while ( opt);
               cout<<"you won ! ";
               return 0; 

To be honest, there's more wrong with this code than right.. The random curly-bracket on the first line for example. And C++ doesn't come with a function called random(). You're probably better of starting over and taking it small steps at a time.
1. Make a program with a main() which compiles;
2. Add something to take in a number and make sure it compiles;
3. Google around for a random-number generator and try adding it to your program

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.