|
UKM_Student wrote: Erm i tried running ur program but it was an infinite loop o.o
Did you remember to increment count ?
UKM_Student wrote: and whats the meaning of number[5]?
It's an array of 5 integers.
"Old age is like a bank account. You withdraw later in life what you have deposited along the way." - Unknown
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
|
|
|
|
|
i declared the variable "total" and where do i do the increment count thingy?Sorry i kinda noob
Array of 5 integers meaning?
|
|
|
|
|
UKM_Student wrote: ...where do i do the increment count thingy?
In the while() loop.
UKM_Student wrote: Array of 5 integers meaning?
Instead of having:
int number1, number2, number3, number4, number5; it would be easier to have:
int number[5]; Wouldn't you agree?
"Old age is like a bank account. You withdraw later in life what you have deposited along the way." - Unknown
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
|
|
|
|
|
kinda but my lecturer haven't taught me that yet so i don't it would be decent for me to use that xD
Oh btw,can help me one last time?
MY last question(Thank God) is to display all upper case letters using a while loop.Any idea how to do it? xD
If im not mistaken,i think we nid to use char type
|
|
|
|
|
UKM_Student wrote: ...but my lecturer haven't taught me that yet so i don't it would be decent for me to use that
Agreed. In that case, you'd need 5 separate variables.
UKM_Student wrote: MY last question(Thank God) is to display all upper case letters using a while loop.Any idea how to do it?
Yes, I have an idea. What are you proposing and I'll nudge you along?
"Old age is like a bank account. You withdraw later in life what you have deposited along the way." - Unknown
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
|
|
|
|
|
Lol ok xD
cout<<"f. The display of Upper Case Letters are as follows : ";
char Letter1,counter=1,Letter,a;
while((counter<=26))
{
Letter1=a;
Letter=Letter1+1;
counter++;
}
cout<<Letter;
to tell u the truth,i really don't know how to display those letters LOL :P
|
|
|
|
|
UKM_Student wrote: char Letter1,counter=1,Letter,a;
char Letter1 = 'A'; UKM_Student wrote: while((counter<=26))
{
Letter1=a;
Letter=Letter1+1;
counter++;
}
cout<<letter;< blockquote="">
while (Letter1 <= 'Z')
{
cout << Letter1 << endl;
Letter1++;
}
"Old age is like a bank account. You withdraw later in life what you have deposited along the way." - Unknown
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
|
|
|
|
|
Geez,never thought it was that easy >_>
Heh,anyway thanks so much for your help. xD 
|
|
|
|
|
int N1, N2, N3;
while ()
{
// what would go here?
}
Maybe i didn't write my question properly xD,it should have been a program that prompts a user to key in 5 numbers then the program will add them up..... xD
|
|
|
|
|
You can't eat your cake and have it too. Think about it: if you are not somehow saving each value that is input (i.e., you are reusing number each time), how could you expect to display those after the while() loop ends?
"Old age is like a bank account. You withdraw later in life what you have deposited along the way." - Unknown
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
|
|
|
|
|
Oh i think i get what u mean,most probably my lecturer haven't teach me yet so i won't try to use it first xD
Have been spending the whole afternoon doing just 5 easy questions ._.
|
|
|
|
|
Hi,
Any suggestions how I might be able to control the size of MessageBox in MFC?
I use AfxMessageBox to display the box, but it doesn't accept long lines, it moves it to the next line when the line gets to certain size I guess.
Thanks
|
|
|
|
|
Software2007 wrote: I use AfxMessageBox to display the box, but it doesn't accept long lines, it moves it to the next line when the line gets to certain size I guess.
What string are you passing to it?
"Old age is like a bank account. You withdraw later in life what you have deposited along the way." - Unknown
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
|
|
|
|
|
|
And the contents of that object would be?
"Old age is like a bank account. You withdraw later in life what you have deposited along the way." - Unknown
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
|
|
|
|
|
Not sure what you mean,
I have something like the following,
CString Msg;
Msg.Fomrat("This is a long first line to display here to make my point\nThis is a long Second line to display here to make my point");
AfxMessageBox(Msg,MB_OK);
The output:
This is a long first line to display here to make my
point
This is a long Second line to display here to make my
point
Can I resize the box to make the first and second line fit without breaking them?
|
|
|
|
|
Software2007 wrote: Can I resize the box to make the first and second line fit without breaking them?
Your code snippet worked fine for me (ie, no wrapping). When I increased the length of the first line to 128 characters, it wrapped. I don't know what's going on.
"Old age is like a bank account. You withdraw later in life what you have deposited along the way." - Unknown
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
|
|
|
|
|
That was just a rough snippet, but how can I avoid the wrap when it does get to 128 characters? Is there a different method that I would be able to display a line of > 128 chars, doesn't have to be a MessageBox function.
Thanks
|
|
|
|
|
Create your own message box.
"Old age is like a bank account. You withdraw later in life what you have deposited along the way." - Unknown
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
|
|
|
|
|
Meaning to create a dialog or somehow override the functionality of the "AfxMessageBox" ?
|
|
|
|
|
Software2007 wrote: Meaning to create a dialog...
Yes.
"Old age is like a bank account. You withdraw later in life what you have deposited along the way." - Unknown
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
|
|
|
|
|
Thanks, it helps that I already have this done, but I wasn't too sure if there was a way to control the size of the Message Box by setting something that I didn't know of. But, I am assuming the answer is NO.
|
|
|
|
|
As we used to tell our users "Working as coded". AfxMessageBox is a wrapper for the Win32 MessageBox() function, whose job is to provide a simple dialog with a message and a couple of buttons. The box will resize itself to a certain extent based on the message to display, but its purpose is merely to display the information, and not to provide parameterisation: that function is provide by Dialog boxes q.v.
|
|
|
|
|
No, except indirectly by inserting LF ('\n') characters.
|
|
|
|
|
Didn't get it, will this make the box wider or taller?
|
|
|
|