Hello all
I started computer science and C++ programming only 6 weeks ago with no prior knowledge. It's a great language, the only other one apart from English that I hope to speak fluently quite soon. I look forward to participating further on these forums, seeking answers and looking at previous threads. Hopefully I will be able to help others later on. Let me cut to the chase.
1. The problem statement, all variables and given/known data:
Although this is an assignment question, it isn't due for a while, and I'm mainly only awake at 4:20am for the sake of it. The question asks to write a C++ program that converts a 4-digit octal number to decimal. I wrote and compiled it, but there's something wrong. I don't think it's arithmetic, because the program terminates at return 1, even if there isn't an 8 or a 9.
2. Relevant commands, code, scripts, algorithms: 3. The attempts at a solution (include all code and scripts):
As you can see in the code, i checked the output of each digit. It returned a dud result.
Tried removing the if statement testing for 8s and 9s. Returned a large negative number.
Also tried other fine-tuning methods to no avail.
4. Complete Name of School (University), City (State), Country, Name of Professor, and Course Number (Link to Course):
University of Wollongong, Wollongong, Australia, Daniel Saffioti, CSCI114
Here are a few lines from my script. The problem I am having is that the statement for gstat returns this error:
line 43:
The statement is coming from gstat.
Is there a way to fix it? Apparently -eq 02 is coming up as some octal value, I need it to be recognized as 02.
Apparently in... (4 Replies)
Hi ,
seq can be 0...128
int windex = seq / 8;
int bindex = seq % 8;
unsigned char bitvalue = '\x01' << (7-bindex) ;
bpv.bitmapvalue = bitvalue;
This is the part of a program to convert decimal to bitmap value of hexadecimal.
I want this to change to convert only to... (1 Reply)
Hi,
I have a file tp.txt having below data
CE2DD,N,5055,16.12.2013,3.114,12195.89,MVR,003388,Web::00000005055,Web Payment
and i am using below code to print the values
for var_amt_pay in `awk -F',' '{ arr += $6} END {for (i in arr) {print i "," arr } }' tp.txt`
do
... (2 Replies)
I have a below snippet of code from my perl script and its causing a problem when the output of $lTAX is 0 (zero) its getting displayed as -0.00. I want output to be 0 not -0.00. Any help would be appreciated.
#!/usr/bin/perl
my $lTotA = 50.94;
my $lVatA = 8.49;
my $lAllocD;
my $lAdjNr =... (4 Replies)
The file contains code like the below and need to convert each one into a decimal
00 00 00 04 17 03 06 01
So the output should come as
0 0 0 4 23 3 6 1 (24 Replies)
I'm relatively new to both UNIX and Linux and slightly less new at programming. But I can't figure out why this won't run properly.
It's meant to calculate the GCD of two numbers (simple enough, you'd think). And I designed it myself and it looks good to me and my instructor won't respond. If... (1 Reply)
Use and complete the template provided. The entire template must be completed. If you don't, your post may be deleted!
1. The problem statement, all variables and given/known data:
Design an algorithm that accepts an input a decimal number and converts it into BCD (Binary... (2 Replies)
Anybody please help me...
Design an algorithm that accepts an input a decimal number and converts it into BCD (Binary Coded Decimal) representation. Also, draw its Flow Chart.
This is a unix qn...
plz post algorithm for that :confused: (1 Reply)
Hello everybody,
I would like to understand why the printf function is returning me an octal value with this command :
printf %4.4d 0010 returns 0008
printf %4.4d 10 returns 0010
Thanks for help. (3 Replies)