Err...
read: # < a number?
then
read: base < you mean base number, such as 2 (binary), 8 (octa), etc.???
print: decimal representation < you mean base 10 number???
If so, you should start with write down a stepbystep of what you would do when you want to create a program. You already got...
/*
++
 read input 
++

V
++
 read base 
++

V
++
 display decimal 
++
*/
Now what you need is to expand each of the rectangle to smaller tasks. The loop can come later once you can get it working.
Err...
read: # < a number?
then
read: base < you mean base number, such as 2 (binary), 8 (octa), etc.???
print: decimal representation < you mean base 10 number???If so, you should start with write down a stepbystep of what you would do when you want to create a program. You already got...
/* ++  read input  ++  V ++  read base  ++  V ++  display decimal  ++ */
Now what you need is to expand each of the rectangle to smaller tasks. The loop can come later once you can get it working.
yes..he specified binary..I have never seen stuff like this before thats why I am so lost :((
Im lost on coding the output..i know how to read the number and the base...just have no idea on how the binary..help!!
I was thinking using
switch case '1':
res = ((x48)*4) + (y48)*2) + (z48)*1))
something like that for each case
Well, how about you think of it in each case. There should be 4 cases in this case...
case #1  enter base 2 number, you can easily convert a binary (with 0 and 1) by iterating through the number and add the total sum of 2^(n1) where n is the number of digit entered.
case #2  enter base 8 number, you can do the same thing as in base 2
case #3  enter base 10 number, you just simply display it.
case #4  enter base 16 number, you also do the same thing as in base 2 & 8.
What you really need to keep in the loop are...
1)The input number must be 0, 1, 2, .., 9, A~F. Other input will be reject and need to be reenter.
2)After you accept a number, you must verify that the base type enter matches the number type. For example, a base 2 must consist of only 0 and 1. If it doesn't match, you could either reject and ask for a new input number or reject and ask for a new base number.
You need to solve this 2 loop problem first. Once you get correct input values, you compute and display result. After that you may add another loop for user to either enter again or quit. That's all...
PS: Use a loop to go through a number string when compute. Why do you need hard coded when you can actually read each character from the input number string using a loop?
Edited 5 Years Ago by Taywin: n/a
Need some help with this Array. I am trying to get the sum of the even numbers and the sum of the odd numbers using a for each loop. I know the answers to what I am trying to achive are sum of even = 84 and the sum of ...
When I execute this progammatically, I get a table with row heights much larger than when I do this manually.
Note : Sel is the Word.Selection object and the Clipboard contains an Excel Table.
public void AddClipboard()
{
Sel.PasteExcelTable(false,false, false);
var t = Sel.Tables[Sel.Tables.Count];
t.AutoFitBehavior(Word.WdAutoFitBehavior.wdAutoFitContent);
}
I have a 2d matrix with dimension (3, n) called A, I want to calculate the normalization and cross product of two arrays (b,z) (see the code please) for each column (for the first column, then the second one and so on).
the function that I created to find the ...