Is this how the computer would operate on this problem?
Type: Posts; User: nirvana21
Is this how the computer would operate on this problem?
How would I divide these two binary numbers?
100101/011011
This is assuming I am on a 6bit 2's complement machine. I would understand how to do it if the first number were not negative. How do...
I thought I was taking the value '1', not ASCII '31'. Should I make number an int, then process it with a modulo instead? Thanks!
Well if I run that program I get a bogus answer. For example if I input 2 as the base and 111 as the number the answer should be 7. If I take out number[index] from the highlighted part it works for...
I have been toying with this problem for a bit and it is starting to annoy me. I cannot find the fault in this program. I believe the problem is due to the use of number[index]. Please help, thanks!...
I am having a rounding problem as well. I thought that a number that is converted from double or float to an int would round up. Example: double .001 = int 1. This must not be the case because I am...
So this doesn't cause an error, its just inefficient?
++letters[index];
This increases the variable beforehand correct? So really what I had would have worked but this is sleeker?
Thanks
Here is my final program. Please critique if you feel like it. I am new to C++ so tell me how it is.
#include <iostream>
#include <iomanip>
#include <fstream>
#include <string>
...
I just want to say that this forum has really helped me with this program. Thanks to all of you. Maybe later I will post my final program to be critiqued.
:cool:
Alright, well I am gonna ask a few questions about this because I have just recently started C++; I hope you don't mind Elysia.
1. Why does it matter that the '&' symbol is connected to ifstream...
Excellent, everything has worked out. THANKS!
So now I can compile which is a lot better then where I was. So I am curious; why does the variable "filename" have to be a pointer?
I get a segmentation fault when I attempt to open a .txt or...
So a reference can be thought of as a type of pointer with restrictions? The reference does not pass the memory address, rather it directly accesses the value?
I have tried using a reference but I...
If I pass a reference can I still pass back the location of the file so it can be utilized in another function? Later I will make another function that will read the characters. Is there a different...
How do you pass a reference?
I am close, but after these alterations I still get one error. Am I correct in thinking that FILE is used in C and fstream is C++ "edition" or however I should word it? Thank you very much for the...
Hi!
I am trying to create a file pointer so I can read characters from a text file. I am not sure that I am doing this correctly. I have been reading a book I have, but I have not quite grasped...
Thank you so much! That worked for me!
Thanks for the insight so far! I initialized the array, but...
I am not sure how to make my structure a pointer. I tried this, but it is not right:
....
void input (id *, int); ...
I am trying to pass structures that I have in an array. The code compiles but the programs spews trash when it runs. Does anybody have an suggestions for me to fix this?
#include <stdio.h>...
yep, that was it.
Thanks!
I have just recently started to learn C. I have been playing around with different code to teach myself. I cannot figure out the following code:
#include <stdio.h>
void testfunction (int *);...