
Getting the length of a string?
Ok so I have an array of char (name[20]) and normally I would use name.size() after I’ve put something in it. But name is in a structure so I did g.name.size() (the actual structure is called golf but it’s referenced by g). But I keep getting a compiler error. What’s wrong?
size() is a method of the C++ “string” class, but a string is more than just a character array. You can use the size method of the string class as follows:
#include
using namespace std;
…
string name = “John”;
cout<<"Name is "<
An array of characters does not have a size() method.
You can, however, find the size of a null-terminated c-string the following way:
char name[20] = "John";
int i=0;
while(name[i]) i++;
cout<<"Name is "<

|
Guide Gear Director’s Chair w/Side Table
$60.00
Director’s Chair w/Side Table…Extra Comfort, Added Convenience! Guide Gear Director’s Chair w/Side Table features: Lightweight construction provides easy carry Portable chair is great for tournament watching or camping Padded seat and armrests ensure comfort anywhere Folding side table with cup holder is great for food and drinks Rubber footed legs offer stability and traction Folds flat for eas…
|

|
Executive SPORT SEAT
Product Description: Executive SPORT SEAT – This PORTABLE SEAT / CHAIR is also a folding WALKING STICK / CANE that is light-weight and strong. Folded, SPORT SEAT is a walking stick for hiking hills, watching or playing golf, walking the local shopping mall, or better yet, making walking possible if your legs are tired or injured. Unfolded, it’s a seat that lets you rest your legs at your convenien…
|

|
Nike 2010 Lady Ace Golf Shoes
Take your most comfortable pair of shoes, pump in maximum NIKE Air cushioning, screw on some grass-gripping spikes and walk yards of beautiful grass. Repeat as often as necessary….
|

|
NYX Carbon Professional Traditional 3-Lens Series Sunglasses
NYX Carbon Professional Sunglasses Traditional 3-Lens Series includes three interchageable Traditional style lenses. Dark Gray Deflector (12% light transmission), Medium Gray Neutralizer (36% light transmission), and Yellow luminator (87% light transmission) lens set. The Deflector uses a special, thin dielectric coating to provide crisp, clear vision while reflecting excessive visible light. Lens…
|

|
Ye Ye: Grandpa Chinese Char. Black Baby Golf Shirt by CafePress
$20.00
This design features the Chinese characters for Paternal Grandpa Ye Ye in black. Baby Tee, TShirt, Shirt. About our Golf Shirt: Tee off in casual style. Our pique knit golf t-shirt is a comfortable, lightweight way to play 18-holes and beat the heat. Features, stylish white pearl buttons, yet it feels like wearing your favorite t-shirt. Dress it up or down. Throw a blazer over lat….
|

|
Lao Ye: Grandpa Chinese Char. Black Baby Golf Shirt by CafePress
$20.00
This design features the Chinese characters for Maternal Grandpa Lao Ye in black. Baby Tee, TShirt, Shirt. About our Golf Shirt: Tee off in casual style. Our pique knit golf t-shirt is a comfortable, lightweight way to play 18-holes and beat the heat. Features, stylish white pearl buttons, yet it feels like wearing your favorite t-shirt. Dress it up or down. Throw a blazer over lat….
|

|
Lao Lao: Grandma Chinese Char. Pink Baby Golf Shirt by CafePress
$20.00
This design features the Chinese characters for Maternal Grandma Lao Lao in pink. Baby Tee, TShirt, Shirt. About our Golf Shirt: Tee off in casual style. Our pique knit golf t-shirt is a comfortable, lightweight way to play 18-holes and beat the heat. Features, stylish white pearl buttons, yet it feels like wearing your favorite t-shirt. Dress it up or down. Throw a blazer over lat….
|

|
Winter Rules
$4.55
Cork’s golf-loving inspector Angus Trum finds a new mystery as he plays host to an African head-of-state and then travels to Africa, getting involved with the building of that county’s first golf course and the trade in smuggled cars….
|

|
Hookers, Lies and Penalties
$16.13
Most golf books are so technical and lesson based that they turn off the newcomers to the game, especially women. NOT Hookers, Lies and Penalties! This is a humorous story with whimsical illustrations about two women learning the game of golf. Through the zany conversations of the two characters, the reader is introduced to the equipment, clothing, golf etiquette and basic rules of the game. Then …
|