Forum: Assembly Aug 25th, 2009 |
| Replies: 11 Views: 817 there are different MIPS?
here is the program i'm working on. hopefully you can determine what flavor it is by looking at it because I'm clueless.
#stuck, cannot figure out square root
... |
Forum: Assembly Aug 24th, 2009 |
| Replies: 11 Views: 817 newton's method means i have to use derivative.... according to that formula. |
Forum: Assembly Aug 24th, 2009 |
| Replies: 2 Views: 402 I've been working on this for hours! the code makes perfect sense, but wont' work!!! aaah! about to pull my hair out.
the code is suppose to do get the sum of this
1/1 + 1/2 + ..... + 1/n
... |
Forum: Assembly Aug 23rd, 2009 |
| Replies: 11 Views: 817 the instruction just says, find the hypotenuse of 2 user input leg of a right triangle. the 2 input are floating points. |
Forum: Assembly Aug 23rd, 2009 |
| Replies: 11 Views: 817 not divide by 2 but separate the digits into 2.
example: if the number I want to root is 96358
9, 63, 58 is what i split it into. |
Forum: Assembly Aug 23rd, 2009 |
| Replies: 11 Views: 817 I tried looking for an algorithm to do so. however, the only ones I came upon requires me to split the number being rooted by 2's. Not possible. |
Forum: Assembly Aug 23rd, 2009 |
| Replies: 11 Views: 817 how do you do a square root in MIPS? I have to write a program to find the hypotenuse of a right triangle and I'm stuck on this part. Please help. |
Forum: Assembly Jun 26th, 2009 |
| Replies: 4 Views: 394 ok, I'm an idiot. double underscore is require for _ _ start |
Forum: Assembly Jun 26th, 2009 |
| Replies: 4 Views: 394 yes I have, and it works fine :) |
Forum: Assembly Jun 26th, 2009 |
| Replies: 4 Views: 394 hello everyone! i usually hang around the c++ area, but I'll need to learn assembly for computer architecture 2 in the fall so here it is. I wrote a simple program to convert temperatures from C to... |
Forum: C++ May 21st, 2009 |
| Replies: 10 Views: 545 I meant to say, read it character by character until the end of line or null character. count the white space as an increment also. |
Forum: C++ May 21st, 2009 |
| Replies: 10 Views: 545 since the file being read is a matrix of "i x j". I would read the file first to get the dimension(read the file character by character to get the i), and read the total /n and /0 character to get... |
Forum: C++ Mar 23rd, 2009 |
| Replies: 3 Views: 222 thank you very much! now i remember what the old man was talking about in class! I only have to compile the client program! |
Forum: C++ Mar 22nd, 2009 |
| Replies: 3 Views: 222 |
Forum: C++ Mar 22nd, 2009 |
| Replies: 3 Views: 222 csci>g++ -c queue.cpp
csci>g++ queue.o project6.cpp
Undefined first referenced
symbol in file
Queue<int>::return_index() ... |
Forum: C++ Mar 20th, 2009 |
| Replies: 1 Views: 355 Why won't this let me choose my own array size?
Queue line[qs_pair] is what i'm concern about. As you can see, I have the user input from the terminal the size of the array. But when I compile... |
Forum: C++ Mar 16th, 2009 |
| Replies: 7 Views: 299 thanks everyone, I didn't end up using push_back, but I sure did use vectors!! strange thing is that I never learned vectors in my intro to computer science class. I wonder why? Anyone else have... |
Forum: C++ Mar 15th, 2009 |
| Replies: 7 Views: 299 ok, back with more questions.
what is push_back?
I want to say it is a function, but not certain. |
Forum: C++ Mar 15th, 2009 |
| Replies: 7 Views: 299 thanks, i'll read up more on vectors since I don't understand it. If i run into any more trouble, you'll see me back here :). |
Forum: C++ Mar 15th, 2009 |
| Replies: 7 Views: 299 I don't understand templates very well, but what I'm getting from this is:
for (int i = 0; i < nQueues; ++i)
v.push_back (Queue());
allocates each queue
for (int i = 0; i <... |
Forum: C++ Mar 15th, 2009 |
| Replies: 7 Views: 299 I'm trying to write a a program that simulates a multi queues, multi server such as a grocery line at the grocery store.
The user will enter the desired number of queue/server pair.
how would... |
Forum: C++ Mar 4th, 2009 |
| Replies: 16 Views: 579 well, turns out i only have to compare +,-,*,/ so i created a function to do so.
since +,- are equal and *, / are equal.
we can say:
int Stacks::check_prec(char check)
{
if((int)check == 42... |
Forum: C++ Mar 4th, 2009 |
| Replies: 16 Views: 579 if my stack is like this(with top being at the top of course)
+
*
/
-
and i say (stack->data) > (stack->next->data)
it will read it correctly? |
Forum: C++ Mar 3rd, 2009 |
| Replies: 16 Views: 579 while(!empty_optr()
&& ((top2 -> data_optr == '/'
|| top2 -> data_optr == '*')
|| (top2 -> data_optr == '+'
|| top2 -> data_optr == '-')
&& (top2 -> next2 -> data_optr == '+'
||... |
Forum: C++ Mar 3rd, 2009 |
| Replies: 16 Views: 579 sorry, I should have been more clear. This is my algorithm here.
while(operator stack is not empty AND the top of operator stack is greater or equal precedence AND top of the operator stack is... |
Forum: C++ Mar 3rd, 2009 |
| Replies: 16 Views: 579 I have a linked list of operators
()+-*/ , how would I be able to compare them if they are all of type char? I looked at the ascii table, but they are all out of order so that isn't a choice. |
Forum: C++ Mar 3rd, 2009 |
| Replies: 19 Views: 1,624 omfg!!!! took 2 hours to figure this out. the problem was i didn't set
top2 == NULL!!!!! in stacks.h |
Forum: C++ Mar 3rd, 2009 |
| Replies: 19 Views: 1,624 here is what I have so far
stacks.cpp
#include <iostream>
#include "stacks.h"
using namespace std;
//append a new node with the data to the stack
void Stacks::push_opnd(Item_opnd entry) |
Forum: C++ Mar 3rd, 2009 |
| Replies: 19 Views: 1,624 In your case, x is a single character right? that is what I need. Because I'm doing an infix stack operation on the lines posted above with linked list, so it is important that 'x' being stored... |
Forum: C++ Mar 2nd, 2009 |
| Replies: 19 Views: 1,624 the reason why I'm doing it the way I am is because I'm taking each character and putting it in a linked list stack to be computed.
example of how the file would look like.
5 + 7 * (9 - 6) + 3... |
Forum: C++ Mar 2nd, 2009 |
| Replies: 19 Views: 1,624 ok, the after searching around I found the poblem. The reason why it is not reading the end of line is because the >> operator skips all isspace character. Instead use
inFile.get(x); |
Forum: C++ Mar 2nd, 2009 |
| Replies: 19 Views: 1,624 after fiddling with it, I also notice that it doesn't detect whitespace either. My program is suppose to find the sum of each line, so if i cannot detect the end of line, i cannot get it to work :(. |
Forum: C++ Mar 1st, 2009 |
| Replies: 19 Views: 1,624 i'm writing this on visual studio with vista. I will be transfering it to unix soon. This does not work on neither. |
Forum: C++ Mar 1st, 2009 |
| Replies: 19 Views: 1,624 inFile >> x;
while(!inFile.eof())
{
if(x == '\n')
{
cout << endl;
}
cout << x;
inFile >> x;
} |
Forum: C++ Feb 19th, 2009 |
| Replies: 3 Views: 909 nvm figured it out, i forgot to do temp->next = NULL; before i assigned it to last. |
Forum: C++ Feb 19th, 2009 |
| Replies: 3 Views: 909 void List::remove_last()
{
if(first == NULL && last == NULL)
{}
else
{
Node *temp;
temp = last -> back; |
Forum: C++ Feb 19th, 2009 |
| Replies: 3 Views: 909 void List::remove_last()
{
if(first == NULL)
{
first -> data = ' ';
}
else
{ |
Forum: C++ Feb 19th, 2009 |
| Replies: 8 Views: 653 hm..., i'll email my professor. |
Forum: C++ Feb 19th, 2009 |
| Replies: 8 Views: 653 doesn't work either :(.... it's driving me nuts, i cannot find any errors within the codes. |
Forum: C++ Feb 19th, 2009 |
| Replies: 8 Views: 653 it does the same thing when i compile all 3 files.
g++ list.h list.cpp program4.cpp
list.cpp = implementation file
program4.cpp = client program |