09-24-2005, 04:20 AM
In my CS130 class, one assignment requires me to print out 8 business cards, 4 rows high and 2 columns high. Easy. The only slight problem was that, to draw the 2 columns of business cards, I do something like this:
cout << strCompanyname << strWhitespace << strCompanyname << endl;
This was done for every line of the card, and as a result the card looks something like this:
Of course, this is because strWhitespace is the same value. So, to fix this I decide to make another function that returns a string of whitespaces just the right length so the second column would look nice and even. One of the things I had to do was find the length of the string. "No problem", I think, "Just use the strlen." However, I got a rather nasty surprise when I got this:
googling found nothing for this error. So, I've been wondering, does my compiler support strlen?
Btw, Although i'm running windows, I'm SSHing to the school servers and running the unix terminal. The compiler i'm using is CC... that's all I know about it. Help would be appreciated about how to get the strlen working or about an alternative to it.
Oh, one last thing... for strings, instead of using character arrays, we're declaring our strings like this:
string stringname;
where stringname contains a string of characters, but will not hold spaces.
cout << strCompanyname << strWhitespace << strCompanyname << endl;
This was done for every line of the card, and as a result the card looks something like this:
Quote:Black_toque_software Black_software
Regina,_sk Regina,_sk
blah blah blah blah blah blah
sdkfsod sdkfsod
Of course, this is because strWhitespace is the same value. So, to fix this I decide to make another function that returns a string of whitespaces just the right length so the second column would look nice and even. One of the things I had to do was find the length of the string. "No problem", I think, "Just use the strlen." However, I got a rather nasty surprise when I got this:
Quote:Error: Could not find a match for std:trlen(std::basic_string<char, std::char_traits<std>, std::allocator<std>>).
googling found nothing for this error. So, I've been wondering, does my compiler support strlen?
Btw, Although i'm running windows, I'm SSHing to the school servers and running the unix terminal. The compiler i'm using is CC... that's all I know about it. Help would be appreciated about how to get the strlen working or about an alternative to it.
Oh, one last thing... for strings, instead of using character arrays, we're declaring our strings like this:
string stringname;
where stringname contains a string of characters, but will not hold spaces.
Jumping Jahoolipers!