Forum: C++ Feb 22nd, 2008 |
| Replies: 2 Views: 4,309 Why are you taking pain by handling memory yourself. Use power of STL.
#include <vector>
#include <stdexcept>
template <typename T>
class Stack
{
private:
std::vector<T> elems; //... |
Forum: C++ Feb 20th, 2008 |
| Replies: 6 Views: 775 The reason for linker error is that the definition of the function template has not been instantiated. In order for a template to be instantiated, the compiler must know which definition should be... |
Forum: C++ Feb 18th, 2008 |
| Replies: 5 Views: 1,577 If you would have been given an options to implement operator++() which would work for both versions of ++, how would you do it?
You need to find some way to distinguish between both of them. |
Forum: C++ Feb 16th, 2008 |
| Replies: 1 Views: 540 Best way would be to get a book. Some of the recommendations http://www.daniweb.com/forums/thread70096.html
One online tutorial
http://www.cplusplus.com/doc/tutorial/ |
Forum: C++ Feb 16th, 2008 |
| Replies: 10 Views: 1,265 dexter1984,
Why don't you simply use vector of vectors
#include <vector>
template <typename T>
class dynamic_array
{
public: |
Forum: C++ Feb 16th, 2008 |
| Replies: 6 Views: 990 Another link void main(void) - the Wrong Thing (http://users.aber.ac.uk/auj/voidmain.shtml) |
Forum: C++ Feb 16th, 2008 |
| Replies: 1 Views: 511 Function call operator is () not []. There are few undeclared variables and some variables with incorrect names. |
Forum: C++ Feb 16th, 2008 |
| Replies: 3 Views: 585 |
Forum: C++ Feb 14th, 2008 |
| Replies: 7 Views: 3,197 Like Larry Wall said:
"Make simple things easy." |
Forum: C++ Sep 1st, 2007 |
| Replies: 4 Views: 1,381 Here's another tutorial (http://www.cplusplus.com/doc/tutorial/exceptions.html) |
Forum: C++ Sep 1st, 2007 |
| Replies: 13 Views: 1,512 Also correct the way you use exception handling in code. |
Forum: C++ Sep 1st, 2007 |
| Replies: 5 Views: 3,362 The term handle is used to mean any technique that lets you get to another object — a generalized pseudo-pointer. The term is (intentionally) ambiguous and vague.
Read more... |
Forum: C++ Aug 27th, 2007 |
| Replies: 16 Views: 6,018 const char *str="SpS";
cout << str;
str = NULL; |
Forum: C++ Aug 27th, 2007 |
| Replies: 2 Views: 759 http://www.daniweb.com/forums/announcement8-2.html |
Forum: C++ Aug 27th, 2007 |
| Replies: 15 Views: 1,426 Take a look at http://en.wikipedia.org/wiki/Fibonacci_number |
Forum: C++ Aug 27th, 2007 |
| Replies: 4 Views: 7,456 You could approach like this
#include <vector>
template <typename T>
class dynamic_array
{
public:
dynamic_array(){};
dynamic_array(int rows, int cols)
{ |
Forum: C++ Aug 27th, 2007 |
| Replies: 9 Views: 3,420 You can make use of vector<vector<T> > |
Forum: C++ Aug 23rd, 2007 |
| Replies: 3 Views: 1,994 Internet File Downloading Function
http://www.codeguru.com/cpp/i-n/internet/filetransfer/article.php/c3399/
(http://www.daniweb.com/forums/Internet%20File%20Downloading%20Function) |
Forum: C++ Aug 23rd, 2007 |
| Replies: 3 Views: 3,093 Help yourself by reading this (http://www.daniweb.com/forums/announcement8-2.html) |
Forum: C++ Aug 21st, 2007 |
| Replies: 11 Views: 4,965 Startup routines that call main could be assuming that the return value will be pushed onto the stack. If main() does not do this, then this could lead to stack corruption in the program's exit... |
Forum: C++ Aug 21st, 2007 |
| Replies: 1 Views: 985 Did you try Google. You can find loads of them. |
Forum: C++ Aug 20th, 2007 |
| Replies: 5 Views: 3,942 You might try this http://gmplib.org/ |
Forum: C++ Aug 20th, 2007 |
| Replies: 5 Views: 3,942 You can even set the precision like this std::cout.precision(15); |
Forum: C++ Aug 20th, 2007 |
| Replies: 5 Views: 3,942 You can use istringstream
#include <sstream>
#include <iostream>
int main()
{
std::istringstream stm;
double number; |
Forum: C++ Aug 20th, 2007 |
| Replies: 8 Views: 876 Read about Sequence Points (http://www.c-faq.com/expr/seqpoints.html) |
Forum: C++ Aug 20th, 2007 |
| Replies: 9 Views: 3,104 Yes, you can do this in main
TestPtr p(Test::create());
auto_ptr is a pointer-like object (a smart pointer) whose destructor automatically calls delete on what it points to as soon as scope ends... |
Forum: C++ Aug 20th, 2007 |
| Replies: 10 Views: 1,567 That's incorrect. It was only required in C89/90. C++ never had such requirement. Even C99 removes this restriction. |
Forum: C++ Aug 20th, 2007 |
| Replies: 4 Views: 4,488 You can make use of qsort() or std::sort |
Forum: C++ Aug 20th, 2007 |
| Replies: 3 Views: 4,745 Just take typedef int value_type; out of class. Things should work. |
Forum: C++ Aug 20th, 2007 |
| Replies: 9 Views: 3,104 You can provide static create() member functions which create the object using new and return a pointer to the allocated object.
typedef auto_ptr<Test> TestPtr;
TestPtr Test::create()... |
Forum: C++ Aug 20th, 2007 |
| Replies: 10 Views: 1,567 There are plenty of problems in your code
1) You are using non-standard headers(iostraem.h,conio.h). You should be sticking to standard headers. You only require <iostream> in your code.
2)Implicit... |
Forum: C++ Aug 19th, 2007 |
| Replies: 10 Views: 1,567 So, you are having trouble with language constructs or logic? |
Forum: C++ Aug 19th, 2007 |
| Replies: 13 Views: 1,925 That's a linker error. It seems that you don't have defination of DisplayRecords(). |
Forum: C++ Aug 19th, 2007 |
| Replies: 13 Views: 1,925 Post your corrected codes(all .cpp and .h files). I will try them at my end with the Makefile. |
Forum: C++ Aug 19th, 2007 |
| Replies: 13 Views: 1,925 I just downloaded your files(.cpp & .h) and tried the Makefile. Makefile just works fine. The problem is with your codes. |
Forum: C++ Aug 19th, 2007 |
| Replies: 13 Views: 1,925 Try implicit rules
CC = g++
ass1: main.o ass1.o
$(CC) main.o ass1.o -o ass1
main.o: main.cpp ass1.h
ass1.o: ass1.cpp ass1.h |
Forum: C++ Aug 19th, 2007 |
| Replies: 4 Views: 8,823 Code will check whether the number entered is integer or not.
ignore extracts characters from the input sequence and discards them. The extraction ends when max characters have been extracted and... |
Forum: C++ Aug 18th, 2007 |
| Replies: 13 Views: 1,925 Try this
CC=g++
ass1: main.o ass1.o
$(CC) main.o ass1.o -o ass1
main.o: main.cpp ass1.h
$(CC) -c main.cpp |
Forum: C++ Aug 18th, 2007 |
| Replies: 2 Views: 1,885 C++ Reverse Disassembly (http://www.codeproject.com/cpp/Reversedisasm.asp) |
Forum: C++ Aug 18th, 2007 |
| Replies: 10 Views: 1,555 In C++ this is considered bad style. In fact, the main(void) style has been called an "abomination" (http://www.research.att.com/~bs/sibling_rivalry.pdf) by Bjarne Stroustrup, the creator of C++,... |