|
ur right about when there're more than one definition of something, say a macro definition. but when i KNOW that i may reach to a definition which exists ONLY ONCE in the whole of my code, not being able to find it by Intellisense is bad.
|
|
|
|
|
Thanks for looking at my question,
I am wondering how I would use the ToUpper and ToLower functions on only part of a string in .net C++.
For example, I converted an inputted name to all caps for the purpose of comparing it. Now I need to display the name with only the first letter capitalized.
In short, I need to make "BRAD" to "Brad"
Note that the inputted name is not always the same, so however you can show me how to do this has to work with any inputted name.
Thanks for any help!!
|
|
|
|
|
TabascoSauce wrote: .net C++
Are you talking about the C++ that uses System::String? If so, there's a forum[^] just for that variant of C++ (and it's not this one).
In general, though, you'd identify the sub-string that you want to convert, extract if from the string, convert it and then re-insert it into the string. HTH!
[edit]In MFC, I'd do it like this:
CString CapitaliseName(CString const& upperCaseName)
{
return upperCaseName.Left(1) + upperCaseName.Mid(1).MakeLower();
}
[/edit]
Java, Basic, who cares - it's all a bunch of tree-hugging hippy cr*p
|
|
|
|
|
Thanks for the help, sorry about the wrong forum, I'll repost there.
|
|
|
|
|
TabascoSauce wrote: sorry about the wrong forum
No problem - BTW - have a look at the System::String docs - I have a feeling you'll find the same methods on that as I used on the MFC CString class....
Java, Basic, who cares - it's all a bunch of tree-hugging hippy cr*p
|
|
|
|
|
I have a rich text edit control which I fill with a small amount of text at runtime. I've managed to slim the RTF down to:
{\rtf1\ansi\deff0{\fonttbl{\f0\fswiss\fcharset0 Segoe UI;}}
\viewkind4\pard\sa80\b\f0\fs24 Test string\par
\b0\fs16 Another string }
This displays the text in Segoe UI font. As this font is usually only available on Vista, I'd like to provide a list of font names in order of priority that the control would try to use in order until it found one that exists on the PC.
Is there a way to do this in the RTF description?
|
|
|
|
|
Don't think so - the RTF specification specifies that a single font name can be associated with a font number, not a set of fonts. Also, you can use only a single number when specifying a font in text, not a list.
I don't think RTF has any concept of font fallback.
Java, Basic, who cares - it's all a bunch of tree-hugging hippy cr*p
|
|
|
|
|
Thanks. Is there a quick way of finding out if a particular font name exists on the PC? Then I could at least have two RTF strings, one using Segoe UI, and another using Trebuchet MS for when Segoe UI is not present?
|
|
|
|
|
|
Hello,
i need to sort out this problem:
"The bubble sort represented in fig 6.15 of your text book is inefficient for large arrays. Make the following simple modifications to improve the performance of the bubble sort.
After the first pass, the largest number is guaranteed to be in the highest-numbered element of the array; after the second pass, the two highest numbers are “in place,” and so on. Instead of making nine comparisons on every pass, modify the bubble sort to make eight comparisons on the second pass, seven on the third pass and so on."
Could someone check my code? I should get an output like this but i don't :
After pass 0: 2 4 6 8 10 12 68 45 37 89
After pass 1: 2 4 6 8 10 12 45 37 68
After pass 2: 2 4 6 8 10 12 37 45
After pass 3: 2 4 6 8 10 12 37
After pass 4: 2 4 6 8 10 12
After pass 5: 2 4 6 8 10
After pass 6: 2 4 6 8
After pass 7: 2 4 6
After pass 8: 2 4
There is something wrong with the loop...
Thanks a lot!!!
raeiko
#include <stdio.h>
#define SIZE 10
int main ( void )
{
int a[ SIZE ] = { 2, 6, 4, 8, 10, 12, 89, 68, 45, 37 };
int pass;
int i;
int hold;
int NumOfComparisons = 0;
printf( "Data items in original order:\n\n" );
for ( i = 0; i <SIZE; i++ ){
printf( "%4d", a[ i ] );
}
printf( "\n\n" );
for ( pass = 1; pass < 9; pass++ ){
for ( i = 0; i < 9 - pass; i++ ){
if ( a[ i ] > a[ i + 1] ){
hold = a[ i ];
a[ i ] = a[ i + 1];
a[ i + 1] = hold;
}
NumOfComparisons = NumOfComparisons + 1;
}
for ( i = 0; i < SIZE - pass; i++ ){
printf( "After pass %d: %4d\n", pass, a[ i ] );
printf( "\n " );
}
}
printf( "Data items in ascending order:\n\n" );
for ( i = 0; i < SIZE; i++ ){
printf( "%4d", a[ i ] );
}
printf( "\n\n" );
printf( "Number of comparisons: %d\n", NumOfComparisons );
return 0;
}
|
|
|
|
|
1. You've got the loop bounds for pass and i wrong (hint - think SIZE)
2. Your print loop contents is incorrect
Apart from that, the algorithm's correct.
Java, Basic, who cares - it's all a bunch of tree-hugging hippy cr*p
|
|
|
|
|
Don't like to do exercise for others
Anyway, the following is the fastest possible bubble sort I know;
bool sorted = false;
for (int i=1; i<N && !sorted; ++i)
{
sorted = true;
for (int j=0; j<N-i; ++j)
{
int k = j + 1;
if (A[j] > A[k]) {
int t = A[j];
A[j] = A[k];
A[k] = t;
sorted = false;
}
}
}
--
Arman
|
|
|
|
|
Hi,
I have created one button control dynamically. i have one requirement of need to visible the button whenever i have clicked on check box.
If i uncheck the check box the button control should be un visible..
Can any one help me out how it is possible in the MFC..?
Thanks
Venki
|
|
|
|
|
does this help?[^]
Luc Pattyn [Forum Guidelines] [My Articles]
- before you ask a question here, search CodeProject, then Google
- the quality and detail of your question reflects on the effectiveness of the help you are likely to get
- use the code block button (PRE tags) to preserve formatting when showing multi-line code snippets
|
|
|
|
|
Please don't tell the secret to everybody!
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
[My articles]
|
|
|
|
|
Can you help me out with a CEditView SDI sample? I tried to search the standard Superpad application.. I couldn't locate a downloadable version.
|
|
|
|
|
Disable and Visible are 2 different things.
So you have to be specific as to which you want to set.
'Cause reading a person's mind through this forum is impossible.
EnableWindow is for enable/disable and ShowWindow is for show/hide.
«_Superman_»
|
|
|
|
|
HELP PLEASE!!!
I have been stuck learning c programming for about 2 days. My code wont compile and here it is:
#include
main()
{
printf("Is your printer on (Y/N)?"); /*Request Y or N */
scanf(" %c",&ans);
if ((ans == 'Y') || (ans == 'N'))
{/*Gets here if user typed a correct answer*/
if (ans == 'N')
{printf("* * Turn the printer on now. * * *\n");
}
}
else
{
printf("You did not enter a Y or N.\n");
return 0;
}
-- I know that the problem is in line 4 but I haven't been able to learn how to use the "%c" because I cant find a book that completely explains it. PLEASE HELP
|
|
|
|
|
Where's char ans;?
You need to a good book for C like
"Beginnig C"
From Novice to Professional,
Fourth Edition
Ivor Horton
Of one Essence is the human race
thus has Creation put the base
One Limb impacted is sufficient
For all Others to feel the Mace
(Saadi )
|
|
|
|
|
I would strongly recommend this book - online tutorials can get you so far, but you really need a book to properly explain not only about the actual language itself, but the way in which to code certain tasks and explain methodologies and paradigms applicable with the language.
Regards,
--Perspx
"A refund for defective software might be nice, except it would bankrupt the entire software industry in the first year." -Andrew Tanenbaum
"Einstein argued that there must be simplified explanations of nature, because God is not capricious or arbitrary. No such faith comforts the software engineer." -Fred Brooks
|
|
|
|
|
Hi ya
I need a good class for saving / loading application settings. I have the following demands for how it should be built:
1) It should be able to handle groups of settings (One group for each view in the application)
2) It should maintain the settings in memory.
3) It should provide an open interface, so one can attach any serialization / deserialization logic (registry-, ini-, xml-file, etc.)
4) It should not have a restricting license like GPL or similar
I can find lots of articles about saving to ini-files, registry-files, xml-files, etc. But I haven't found an article that makes the abstraction I want.
Please let me know
modified on Saturday, February 14, 2009 9:51 AM
|
|
|
|
|
Did you think about your question you need to a class for save application settings of your program you need to make it yourself I think you found your answer previous(ini files,xml files and registry) you need to make a class for them then you need to shift your parameters to that class.
Of one Essence is the human race
thus has Creation put the base
One Limb impacted is sufficient
For all Others to feel the Mace
(Saadi )
|
|
|
|
|
I'm not asking for help to invent the wheel, but asking for help to find an article / library that can provide the implemention of the wheel I need.
I rather want to reuse than to remake it myself.
modified on Saturday, February 14, 2009 11:06 AM
|
|
|
|
|
Good idea: develop it and write a good article about.
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
[My articles]
|
|
|
|
|
Thank you for the encouragement
|
|
|
|