Hey, I need assistance in creating a IPO Chart for a homework assigment.


Problem

Write a program that prompts the user to input a four-digit number positve integer.
The program then outputs the digits of the number, one digit per line.
For example, if the input is 3245.

3
2
4
5

This is what I have so far

Input- Fourdigitnumber
Output- Number1, Number2, Number3, Number 4

I am lost after that :(

I need some assistance


Thank you

Recommended Answers

All 30 Replies

after inputting the number start a loop that uses the mod operator % to get the last digit of the number and then divide the number by 10 until the result is 0.

Or input the number as a character array then simply display each character on a separate line.

after inputting the number start a loop that uses the mod operator % to get the last digit of the number and then divide the number by 10 until the result is 0.

Or input the number as a character array then simply display each character on a separate line.

How would I Put the Major task (P in the IPO) into words?

Num

3245/1000= [3] num1

number 3245%1000=[245]

number 245/100= [2] num 2

number 45/10= [4] num 3

number 45%10= [5] num 4

thats what I got i need more help in formalizing the Major task, and the soultion algorithm
Help please

Anyone home?

in a loop you use number % 10 and number / 10. for example assume number is 12345
number % 10 = 5
number / 10 = 1234
number % 10 = 4
number / 10 = 123
etc.

>>How would I Put the Major task (P in the IPO) into words
I have no idea what that is.

in a loop you use number % 10 and number / 10. for example assume number is 12345
number % 10 = 5
number / 10 = 1234
number % 10 = 4
number / 10 = 123
etc.

>>How would I Put the Major task (P in the IPO) into words
I have no idea what that is.

I don't know much about loops yet but i was told steps in solution algorithm should be in (pseudocode).

I need help in coming up with major tasks.

this is what im working on so far

1. Fourdigitnumber ("Type your fourdigitnumber ")
Receive Fourdigit number

(Fourdigitnumber)/1000

Thats what I got as of now come mann help me out asap.

Thank you.

no no. take what I posted and put it in a loop. This will display the number backwards though.

enter a 4-digit number
while number > 0
    digit = number % 10
    number = number / 10
    display digit
end while

I suppose you could do it this way too, which will display the digits in the correct order

int modop = 1000
while number > 0
    digit = number / modop
    number = number % modop
    modop = modop / 10
    display digit
end while

no no. take what I posted and put it in a loop. This will display the number backwards though.

enter a 4-digit number
while number > 0
    digit = number % 10
    number = number / 10
    display digit
end while

Scratches Head:confused:

Please have some patience with me im a noob:icon_eek:

This is wat the instructions I have to do for IPO

For IPO,
the I(nput) should be the name(s) you like to use to capture the input(s) of the problem. The O(utput) should be the name(s) you like to use to store the expected output(s) produced by your solution. Be sure all your identifiers/names are valid ones. Please refer to your class notes and text book for details about valid identifiers.
The P(rocess) section should have only description of what major tasks need to be completed in solving the problem. NO DETAILS about how to complete each task are needed. For instance, DO NOT say "subtract DEDUCTION from GROSS_PAY and save result in NET_PAY" in P(rocess) section. Say something like "Compute net pay." instead.
Leave the details about "How" to "Compute net pay." in your Solution Algorithm. So you can concentrate on one task at a time.
Absolutely NO C++ code or keyword of any kind should be used (they are not even needed) in Part I of the Assignment.


This is What I have so far

I Input = Fourdigitnumber

OOutput = Num1, Num2, Num3, Num4

P (aka Major Task that has to be written)

1.Step 1?
2.Step 2?
3.Step 3?

And then I have to Transform steps in solution algorithm (pseudocode)

Can you assist?

Thank You much for your patience

I suppose it might be something like this:
step1: start a loop
step2: extract a digit
step3: remove the digit from the original number
step4: display the digit
step5: go back to setp 2

>>And then I have to Transform steps in solution algorithm (pseudocode)
You can deduce the pseudocode from what I've already posted.

I suppose it might be something like this:
step1: start a loop
step2: extract a digit
step3: remove the digit from the original number
step4: display the digit
step5: go back to setp 2

>>And then I have to Transform steps in solution algorithm (pseudocode)
You can deduce the pseudocode from what I've already posted.

starting a loop might be a little advanced for me since I have not reached that point in the course how do you feel about this version?

1. Receive Fourdigitnumber
2. Extract the digit received
3. Remove the digit from the oringal number
4. Display Digit
5. Repeat Step 2

How would I go about implenmenting steps in the main tasks?

see post #8, but you will have to remove the actual c code/calculations as your instructions say.

see post #8, but you will have to remove the actual c code/calculations as your instructions say.

ok I am working on it right now, can you take a look threw it to check it if makes sense?

Fourdigitnumber ("Type your Four-digit number ")

Receive Fourdigit number

(Fourdigitnumber)/1000
Display Num1

Repeat

End

Does this look right?

>>Does this look right?
1000 can not be hard-coded because it changes on every iteration of the loop. The second iteration it will by 100, then 10 and finally 1 on the last loop.

>>Does this look right?
1000 can not be hard-coded because it changes on every iteration of the loop. The second iteration it will by 100, then 10 and finally 1 on the last loop.

WOWzers :icon_eek: I was afraid of that...so how can I show the math im doing in the pseudocode if the 1000, 1000, 10, 1 can't be hard-coded?

Scratches Head:confused:

Please have some patience with me im a noob:icon_eek:

This is wat the instructions I have to do for IPO

For IPO,
t
Absolutely NO C++ code or keyword of any kind should be used (they are not even needed) in Part I of the Assignment.


This is What I have so far

I Input = Fourdigitnumber

OOutput = Num1, Num2, Num3, Num4

P (aka Major Task that has to be written)

1.Step 1?
2.Step 2?
3.Step 3?

Thank You much for your patience

Ancient dragon has already GIVEN you allot of the code.
He has also patiently written the process in words.
You need to do some Googling on the operators he has used if you don't understand.
try something like entering C++ % in Google. You will get a plethora of pages that define this operator.
Hitting the books might help too.
You will NEVER learn if some one does it for you.
Besides, THAT's not going to happen here, anyway.

Give it the ol' college try. Post your efforts. you will get more help that way.
WE LIKE people who try.

Ancient dragon has already GIVEN you allot of the code.
He has also patiently written the process in words.
You need to do some Googling on the operators he has used if you don't understand.
try something like entering C++ % in Google. You will get a plethora of pages that define this operator.
Hitting the books might help too.
You will NEVER learn if some one does it for you.
Besides, THAT's not going to happen here, anyway.

Give it the ol' college try. Post your efforts. you will get more help that way.
WE LIKE people who try.

And Im not saying he didn't I know what the % mod means, it gives you the remained, I dont appreciate however your efforts in trying to label me as someone who doesn't try, you must not have read my other post

Can anyone else offer some assistance?

Thank you

>>And Im not saying he didn't I know what the % mod means
The mod operator % returns the remainder after division. Example: 1234 % 10 = 4 because 1234 / 10 = 123 with a remainder of 4. When we do integer division there are no decimals -- they are normally just dropped without rounding.

As JRM indicated you already have everything you need to complete the assignment.

>>And Im not saying he didn't I know what the % mod means
The mod operator % returns the remainder after division. Example: 1234 % 10 = 4 because 1234 / 10 = 123 with a remainder of 4. When we do integer division there are no decimals -- they are normally just dropped without rounding.

As JRM indicated you already have everything you need to complete the assignment.

This I already know AD, my conflict as i stated before was figuring out a way of writing this in words. You were telling me earlier that 1000,100, 10, 1 could not be hard coded, but never told me why and how I can go about it. Im not asking anybody to do my work for me like JRM was trying to insinuate. Im just asking for help to make sure what am I doing is correct.

Why? simple 4th grade (or thereabouts) math. Do the math with pencil & paper and it will become clear to you why you have to do it that way. The main reason why is to get the individual digits from left to right -- 1234 becomes 1 2 3 and 4. So 1234/1000 = 1, then 234/100 = 2, and 34/10 = 3, finally 4 / 1 = 4.

>>and how I can go about it.
Yes I did in my post # 8

Why? simple 4th grade (or thereabouts) math. Do the math with pencil & paper and it will become clear to you why you have to do it that way. The main reason why is to get the individual digits from left to right -- 1234 becomes 1 2 3 and 4. So 1234/1000 = 1, then 234/100 = 2, and 34/10 = 3, finally 4 / 1 = 4.

>>and how I can go about it.
Yes I did in my post # 8

How would I Put the Major task (P in the IPO) into words?

Num

3245/1000= [3] num1

number 3245%1000=[245]

number 245/100= [2] num 2

number 45/10= [4] num 3

number 45%10= [5] num 4

thats what I got i need more help in formalizing the Major task, and the soultion algorithm
Help please

:angry: how many times must I say DUH! Im not trying to be mean AD, but you keep misunderstanding me and its fustrating me, I mean how many times do I have to say I know how to do the math to get the single digits to make up the fourdigitnumber..... i mean me quoting myself shows that, incorporating this into words following the outline of steps in my major tasks is my conflict.

. You were telling me earlier that 1000,100, 10, 1 could not be hard coded, but never told me why and how I can go about it..

I mean how many times do I have to say I know how to do the math to get the single digits to make up the fourdigitnumber.

You keep contridicting yourself. At first you said you didn't know the math and now you say you do ??? Don't get mad ad me if you fail to explain yourself.

In any event, I'm not going to just hand over any more of the problem because you already have eveything you need to complete the assignment. If you are still confused about something then maybe you should re-read your textbook and the notes you took (or should have taken) in class.

This I already know AD, my conflict as i stated before was figuring out a way of writing this in words. You were telling me earlier that 1000,100, 10, 1 could not be hard coded, but never told me why and how I can go about it. Im not asking anybody to do my work for me like JRM was trying to insinuate. Im just asking for help to make sure what am I doing is correct.

OK then,
Let's see what you are "doing".
lets see what you have done with AD's code hints thus far.
Take a number in:

int number;// define variable type 
//start a loop
cin >> number; //  this will wait for and take in  number (you should add some cout //<<"text" to clarify what to enter. 
//use AD's code to extract the numbers (add syntax and few other things)

How much spoon feeding do you need?
All I see is whining and very little effort
Sorry,I'm not your mother...

lol when you said hard coded I thought you meant I could not put them in the pseudocode....hey im a noob at this and i showed from the very beginning that i know how to do the math, all i was asking was for you to further explain to the example you provided thats all, instead you go out of your way to try to make me look like im crzy. Im just looking for a better understanding of the material outside of the available office hours of my professor, your meaness is not necessary, I have but more than nice and have thanked numerous for the lil info you have gave me, saying "your not going to hand over the problem" as if i am asking that is sad.

>>your meaness is not necessary
LOL: did you see my avatar? I'm not called Ancient Dragon for nothing :) We dragons are pretty mean critters. (That was supposed to be a joke, so please don't get mad about that statement)

OK then,
Let's see what you are "doing".
lets see what you have done with AD's code hints thus far.
Take a number in:

int number;// define variable type 
//start a loop
cin >> number; //  this will wait for and take in  number (you should add some cout //<<"text" to clarify what to enter. 
//use AD's code to extract the numbers (add syntax and few other things)

How much spoon feeding do you need?
All I see is whining and very little effort
Sorry,I'm not your mother...

This wat i have so far

Input = Fourdigitnum
Output = Num1, Num2, Num3, Num4


Major Task (Module/Subproblems)

1. Receive Fourdigitnum
2. Extract the Fourdigitnum received
3. Remove the digit from the original number
4. Display Digit
5. Repeat Step 2

1. Fourdigitnum ("Enter a four-digit positive integer: ")
Receive Fourdigitnum

2.


Spoon feeding?? you sir are a selfish person for saying that, first off all you don't read. I can't you C++ code in my IPO Sol. Alg. All im asking for is a better explaination of material hell do you expect with only 5 days experience with C++ hmmmmmm?

This wat i have so far

Input = Fourdigitnum
Output = Num1, Num2, Num3, Num4


Major Task (Module/Subproblems)

1. Receive Fourdigitnum
2. Extract the Fourdigitnum received
3. Remove the digit from the original number
4. Display Digit
5. Repeat Step 2

1. Fourdigitnum ("Enter a four-digit positive integer: ")
Receive Fourdigitnum

2.


Spoon feeding?? you sir are a selfish person for saying that, first off all you don't read. I can't you C++ code in my IPO Sol. Alg. All im asking for is a better explaination of material hell do you expect with only 5 days experience with C++ hmmmmmm?

We're not writing pseudo code here in case YOU haven't noticed the title of this board.
Why not expand the loop and math operation in words ?
If this, then do that
divide number by 10
if number > = 10 then...
Bla bla
this is tedious

The purpose of this tedious assignment is to have you painstakingly detail the operation that the code must perform.
Be as tenacious about each detail as you are about posting your needs on this forum.

BTW if it is selfish not to want to read your whinny pleas, then yes, I am indeed selfish.

We're not writing pseudo code here in case YOU haven't noticed the title of this board.
Why not expand the loop and math operation in words ?
If this, then do that
divide number by 10
if number > = 10 then...
Bla bla
this is tedious

The purpose of this tedious assignment is to have you painstakingly detail the operation that the code must perform.
Be as tenacious about each detail as you are about posting your needs on this forum.

BTW if it is selfish not to want to read your whinny pleas, then yes, I am indeed selfish.

[img]http://somecallmeduh.files.wordpress.com/2007/10/captainobvious.jpg[/img]

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.