C++Talk.NET Forum Index C++Talk.NET
C++ language newsgroups
 
Archives   FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

I need help with a program

 
Post new topic   Reply to topic    C++Talk.NET Forum Index -> C++ language (comp.lang.c++)
View previous topic :: View next topic  
Author Message
Pixie
Guest





PostPosted: Thu Sep 29, 2005 3:09 pm    Post subject: I need help with a program Reply with quote



I was asked by professor to figure out the mistakes and fill in the
functions for this program. I cannot figure it out and I hope someone
can help me.Any input would be helpful. Thanks, PIXIE
here is the program:

// digits.cpp
#include <iostream>

using std::cout;
using std::cin;
using std::endl;

int main()
{
int num;

cout << "Enter a five-digit number: ";
cin >> num;

/* write a statement to print the left-most digit of 5-digit number
*/
/* write a statement that changes num from a 5-digits to 4-digits
*/
/* write a statement to print the left-most digit of 4-digit number
*/
/* write a statement that changes num from a 4-digits to 3-digits
*/
/* write a statement to print the left-most digit of 3-digit number
*/
/* write a statement that changes num from a 3-digits to 2-digits
*/
/* write a statement to print the left-most digit of 2-digit number
*/
/* write a statement that changes num from a 2-digits to 1-digit
*/
cout << num << endl;

return 0;
}

Back to top
Howard
Guest





PostPosted: Thu Sep 29, 2005 3:19 pm    Post subject: Re: I need help with a program Reply with quote




"Pixie" <APEXA.GANDHI (AT) gmail (DOT) com> wrote

Quote:
I was asked by professor to figure out the mistakes and fill in the
functions for this program. I cannot figure it out and I hope someone
can help me.Any input would be helpful.

Geez, you could at least make SOME effort at doing your own homework!

-Howard



Back to top
Alf P. Steinbach
Guest





PostPosted: Thu Sep 29, 2005 3:21 pm    Post subject: Re: I need help with a program Reply with quote



* Pixie:
Quote:
I was asked by professor to figure out the mistakes and fill in the
functions for this program. I cannot figure it out and I hope someone
can help me.Any input would be helpful. Thanks, PIXIE
here is the program:

// digits.cpp
#include <iostream

using std::cout;
using std::cin;
using std::endl;

int main()
{
int num;

cout << "Enter a five-digit number: ";
cin >> num;

/* write a statement to print the left-most digit of 5-digit number
*/


Instead of what your professor suggests, try

// write a statement to print the RIGHT-MOST digit of 'num'.

And similarly for the rest.

After you've done that you'll be in a better position to do the prof's
assignment.

--
A: Because it messes up the order in which people normally read text.
Q: Why is it such a bad thing?
A: Top-posting.
Q: What is the most annoying thing on usenet and in e-mail?

Back to top
Pixie
Guest





PostPosted: Thu Sep 29, 2005 3:29 pm    Post subject: Re: I need help with a program Reply with quote

I did try to do this program, and I could not figure it out and that is
why I asked for help. I did not ask anyone to do the program for me, I
only asked for input.

Back to top
Mike Wahler
Guest





PostPosted: Thu Sep 29, 2005 3:31 pm    Post subject: Re: I need help with a program Reply with quote


"Pixie" <APEXA.GANDHI (AT) gmail (DOT) com> wrote

Quote:
I did try to do this program,

If you did try, then you have some code. If you want
help with it, post it and ask specific questions. If
you do that, you'll get plenty of help.

Quote:
and I could not figure it out and that is
why I asked for help. I did not ask anyone to do the program for me, I
only asked for input.

We can't give input on what we can't see.
Post your code.

-Mike



Back to top
Pixie
Guest





PostPosted: Thu Sep 29, 2005 3:37 pm    Post subject: Re: I need help with a program Reply with quote

Thank u. I should rephrase this question and put my ideas on how to do
the code. Thank you.

Back to top
osmium
Guest





PostPosted: Thu Sep 29, 2005 3:40 pm    Post subject: Re: I need help with a program Reply with quote

"Pixie" writes:

Quote:
I was asked by professor to figure out the mistakes and fill in the
functions for this program. I cannot figure it out and I hope someone
can help me.Any input would be helpful. Thanks, PIXIE
here is the program:

// digits.cpp
#include <iostream

using std::cout;
using std::cin;
using std::endl;

int main()
{
int num;

cout << "Enter a five-digit number: ";
cin >> num;

/* write a statement to print the left-most digit of 5-digit number
*/
/* write a statement that changes num from a 5-digits to 4-digits
*/
/* write a statement to print the left-most digit of 4-digit number
*/
/* write a statement that changes num from a 4-digits to 3-digits
*/
/* write a statement to print the left-most digit of 3-digit number
*/
/* write a statement that changes num from a 3-digits to 2-digits
*/
/* write a statement to print the left-most digit of 2-digit number
*/
/* write a statement that changes num from a 2-digits to 1-digit
*/
cout << num << endl;

return 0;
}

See what kinds of wonderful things you can do with the modulo operator
(which is '%' in C++).



Back to top
Display posts from previous:   
Post new topic   Reply to topic    C++Talk.NET Forum Index -> C++ language (comp.lang.c++) All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2006 phpBB Group
SEO toolkit © 2004-2006 webmedic.