I like [URL="

Lusiphur commented: Link looks like a VERY useful site! Thanks :) +1

When you call

string word2("Over");

the string class detects that you passed an array of characters to it and uses that to create word2.

When you call

string word3(3, '!');

the string class detects that you have passed an integer as first parameter and a character as second, it creates a string that looks like this "!!!".

Once you learn about classes and constructors you will understand how the string class decides what to do with the arguments you give it.

Do not get "The c++ Programming Language Third Edition" first, i got stuck very quickly as a newbie.

I make good progress using "Accelerated C++ 2000" however, alot easier to understand.

Also [url]www.learncpp.com[/url] is a great free guide! The most beginner-friendly i have encountered so far.

Hello this is my first post here, i made this search function and i would like some feedback and or tips. (:


// Implement your own [search]strstr[/search] function. (Intermediate)

include "stdafx.h"

include <iostream>

include <string>

using namespace std;

class Search
int m_nTextL;
int m_nSearchL;
int m_nResult;
bool m_bFound;

Search(string strText = 0, string strSearch = 0)
: m_nTextL(strText.length()-1)
, m_nSearchL(strSearch.length()-1)
, m_nResult(0), m_bFound(false)
int aaa = 0; int bbb = 0;

        while(strSearch[aaa] == strText[bbb++])
            { aaa++; break; }

        if(aaa>0 && !(strSearch[aaa] == strText[bbb])) aaa = 0;

        if(aaa == m_nSearchL)
        { m_bFound = true; m_nResult = bbb--; break; }

        if(bbb == m_nTextL)
        { m_bFound = false; m_nResult = 0; break; }

    if(m_bFound == true)    for(bbb--; bbb<=m_nTextL; bbb++)
                    cout << strText[bbb];

    else cout << "No match!";
    cout << endl;


int main()
Search jeg("This is the text i want to search in", "want");
return 0;


Nick Evan commented: Indented code + code-tags on the first post. Good job! +12