ive been at this for a while now trying to understand the logic of adding an item to the top/beginning of a linked list.
//////////////////////////////////////////
struct link //one...
Type: Posts; User: xion
ive been at this for a while now trying to understand the logic of adding an item to the top/beginning of a linked list.
//////////////////////////////////////////
struct link //one...
>Do I just call the funtion like this function() or will have to to write ans in the front like this funtion(ans) so it know I want the value in "ans".
after the function call "ans" already has a...
thanks for the tips. ill keep that in mind.
so basically if the function is only going to be run once per object define it outside of the class?
is there a difference between having a destructor in or out of the class? which one is better? having the destructor inside the class seems more readable. but my book seems to have the destructor...
the book says to use pointer notation wherever possible. but yes. it is ugly.
lol thanks guys. didnt read carefully. toupper returns a character that has been converted. DAMMIT! details xion...details!~!~~!
void upit() //convert to uppercase if necessary
{...
cant get my upit() function to work! cant find anything wrong.
#include<iostream>
#include<cctype>
#include<cstring>
using namespace std;
class String //user-defined string type
{
thanks guys. got it.
im finally at the chapter that deals with linked lists. and to me, its confusing. i cant grasp exactly whats going on here. heres the code from the book that im trying to understand...
...
wow. thanks for taking the time to explain ALL that. :) got it.
thanks for the informative reply. i did some searching on the differences between stack and heap and i just want to make sure i got this right. i edited my first post to include the class person. ...
on declaring an array of pointers to objects does the program allocate memory for 100 persons, or only allocates them upon
persPtr[n] = new person;
? having a hard time understanding the...
my book explains that
class C: public A //able to access public member functions
class B: private A //un-able to access public member functions
isnt the point of inheritance is to add...
thanks for the reply.:D
why is it required to convert it to long double and check the bounds?
the book im reading has an exercise to make a class Int and overload the basic operators. there is 2 things i dont understand. it asks for bounds checking, but i dont know why the answer in the...
f is coming up negative, found a way using exit() in stdlib.h :) thanks guys
the book im following hasnt discussed exceptions yet. is there, perhaps, another way? thanks for the reply though :)
i overloaded the operator '-' to subtract 2 Distances. i dont want to accept negative distance so how do i exit the function? i tried "return -1;" but the return type is of type Distance. do i...
so what will
(3 % 10) + '0' = ?
0 right? it doesnt even divide let alone have a remainder.
thanks for the responses but still somewhat puzzled.
i edited my first post and added a main function where itoa's n = 30. given that n has the value of 30 im trying to step through the code but it...
im having trouble understanding the code in itoa's do while loop. why is this finding the remainder of dividing n by 10 and adding '0'? and the condition while((n/=10)!=0). whats happening here?
...
before any one tells me that this its bad to do this or its dangerous..ive already heard it on IRC and didnt get an answer that probably would've took them 10 seconds to answer than have a big...
i have robert lafore's object-oriented programming in C++. i had no experience in C++ and it starts you out quite nicely. the exercises are nice, states clearly what the book wants you to code. ...
thanks prelude, overlooked that MTF var. for some reason it thought that variable was declared and defined at the same time. :)
p.s. i been switching back and forth through c++ and c. k&r is...