Not logged in [
Login
-
Register
]
You Are Not Registered Or Not Logged In
Corsa Sport
»
Message Board
»
Off Day
»
Geek Day
»
Assembly Language...
» Post Reply
Post Reply
Who Can Post?
All users can post new topics and all users can reply.
Icon:
Formatting Mode:
Normal
Advanced
Help
Andale Mono
Arial
Arial Black
Book Antiqua
Century Gothic
Comic Sans MS
Courier New
Georgia
Impact
Tahoma
Times New Roman
Trebuchet MS
Script MT Bold
Stencil
Verdana
Lucida Console
-2
-1
1
2
3
4
5
6
White
Black
Red
Yellow
Pink
Green
Orange
Purple
Blue
Beige
Brown
Teal
Navy
Maroon
LimeGreen
Message:
HTML is Off
Smilies are On
BB Code is On
[img] Code is On
[quote][i]Originally posted by PaulW[/i] Absolutely pointless program but what the hey, written on Linux though [quote]#include
#include
using namespace std; main() { string a("abcd efg"); string b("xyz ijk"); string c; cout << a << " " << b << endl; cout << "String empty: " << c.empty() << endl; c = a + b; cout << c << endl; cout << "String length: " << c.length() << endl; cout << "String size: " << c.size() << endl; cout << "String capacity: " << c.capacity() << endl; cout << "String empty: " << c.empty() << endl; string d = c; cout << d << endl; cout << "First character: " << c[0] << endl; string f(" Leading and trailing blanks "); cout << "String f:" << f << endl; cout << "String length: " << f.length() << endl; cout << "String f:" << f.append("ZZZ") << endl; cout << "String length: " << f.length() << endl; string g("abc abc abd abc"); cout << "String g: " << g << endl; cout << "Replace 12,1,\"xyz\",3: " << g.replace(12,1,"xyz",3) << endl; cout << g.replace(0,3,"xyz",3) << endl; cout << g.replace(4,3,"xyz",3) << endl; cout << g.replace(4,3,"ijk",1) << endl; cout << "Find: " << g.find("abd",1) << endl; cout << g.find("qrs",1) << endl; string h("abc abc abd abc"); cout << "String h: " << h << endl; cout << "Find \"abc\",0: " << h.find("abc",0) << endl; cout << "Find \"abc\",1: " << h.find("abc",1) << endl; cout << "Find_first_of \"abc\",0: " << h.find_first_of("abc",0) << endl; cout << "Find_last_of \"abc\",0: " << h.find_last_of("abc",0) << endl; cout << "Find_first_not_of \"abc\",0: " << h.find_first_not_of("abc",0) << endl; cout << "Find_first_not_of \" \": " << h.find_first_not_of(" ") << endl; cout << "Substr 5,9: " << h.substr(5,9) << endl; cout << "Compare 0,3,\"abc\": " << h.compare(0,3,"abc") << endl; cout << "Compare 0,3,\"abd\": " << h.compare(0,3,"abd") << endl; cout << h.assign("xyz",0,3) << endl; cout << "First character: " << h[0] << endl; } [/quote] when compiled usin g++, cmd ./a.out lists all this crap :lol: [quote]abcd efg xyz ijk String empty: 1 abcd efgxyz ijk String length: 15 String size: 15 String capacity: 15 String empty: 0 abcd efgxyz ijk First character: a String f: Leading and trailing blanks String length: 37 String f: Leading and trailing blanks ZZZ String length: 40 String g: abc abc abd abc Replace 12,1,"xyz",3: abc abc abd xyzbc xyz abc abd xyzbc xyz xyz abd xyzbc xyz i abd xyzbc Find: 6 4294967295 String h: abc abc abd abc Find "abc",0: 0 Find "abc",1: 4 Find_first_of "abc",0: 0 Find_last_of "abc",0: 0 Find_first_not_of "abc",0: 3 Find_first_not_of " ": 0 Substr 5,9: bc abd ab Compare 0,3,"abc": 0 Compare 0,3,"abd": -1 xyz First character: x[/quote] I think I best get some sleep before I go fekin mad! [Edited on 07-11-2003 by PaulW] [/quote]
Post Options:
Disable smileys?
Turn BBCode off?
Receive email notification of new replies?
This is a long topic, click
here
to review it.