Monday, March 9, 2009

Stack Implementation in C++

Check the following link for the implementation of a stack in C, C++ and Java.
http://www.cs.utsa.edu/~wagner/CS2213/stack/stack.html

Friday, January 23, 2009

Working with Strings

When mixing strings and string literals, at least one operand to each + operator must be of string type:

     string s1 = "hello";   // no punctuation
string s2 = "world";
string s3 = s1 + ", "; // ok: adding a string and a literal
string s4 = "hello" + ", "; // error: no string operand
string s5 = s1 + ", " + "world"; // ok: each + has string operand
string s6 = "hello" + ", " + s2; // error: can't add string literals

Wednesday, January 21, 2009

Error C2065: 'endl' : undeclared identifier

  • To avoid this error we should use the following statement:

using namespace std;