|
b[j][i]=a[i][j];
printf("%d ",b[i][j]); So you wanted to print the value of b[i][j] after you updated b[j][i]?
"the debugger doesn't tell me anything because this code compiles just fine" - random QA comment
"Facebook is where you tell lies to your friends. Twitter is where you tell the truth to strangers." - chriselst
"I don't drink any more... then again, I don't drink any less." - Mike Mullikins uncle
|
|
|
|
|
How to draw a realtime XY plot in MFC.
I have an existing MFC application in which there are many tags that changes continuously.
I have to show the value of 2 tags which changes dynamically. I have to plot an XY plot for the tags in a separate dialog or window in the existing MFC application.
Please suggest me some easiest or quickest ways of doing the above task.
|
|
|
|
|
Well the Microsoft Scribble sample would be a good start.
|
|
|
|
|
I remember trying to learn MFC with that back in 1992.
|
|
|
|
|
|
|
There are many good articles about drawing in mfc - which is really pretty much Win32. Rather than have that magical moment where you get it running and it flickers constantly, make sure to look into double buffering with a bitmap.
Charlie Gilley
<italic>Stuck in a dysfunctional matrix from which I must escape...
"Where liberty dwells, there is my country." B. Franklin, 1783
“They who can give up essential liberty to obtain a little temporary safety deserve neither liberty nor safety.” BF, 1759
|
|
|
|
|
How do you generate random numbers in C++? I C# I had to use a seed and set some range limits/boundaries.
.
modified 2-Jun-20 3:21am.
|
|
|
|
|
|
|
|
A google search would have found the answer quicker than it takes to open a question here. Please try doing a bit of research first.
|
|
|
|
|
k, I`ll keep that in mind next time I post. I still believe in learning by human interaction though.
https://web.facebook.com/pin46/
modified 2-Jun-20 11:12am.
|
|
|
|
|
Keep it in mind before you post. And if you really want to learn a language there are many useful books and tutorials you can make use of.
|
|
|
|
|
|
You may use either the legacy rand()[^] function (with the srand one you might provide the seed), or the classes provided by the 'new' random header[^]. The latter is more sophisticated and has a somewhat more difficult interface. You might look at code samples, though, for instance, see the code in this page[^].
|
|
|
|
|
Thank you CPallini
my name is Calin Negru, I also post on GameDev.net
modified 20-Jun-20 3:14am.
|
|
|
|
|
|
void main()
{char name[50],came[50];int i;
gets(name);
gets(came);
for(i=0;name[i]||came[i];i++)
{int d=name[i]-came[i];
if(d==0)
return printf("Equal");
else return printf("Unequal");
}
}
|
|
|
|
|
Using return where you do, exits the current function you are in, in this case it is main(). So you are exiting the program when you call return.
"the debugger doesn't tell me anything because this code compiles just fine" - random QA comment
"Facebook is where you tell lies to your friends. Twitter is where you tell the truth to strangers." - chriselst
"I don't drink any more... then again, I don't drink any less." - Mike Mullikins uncle
|
|
|
|
|
|
<pre>#include<stdio.h>
void main()
{char name[40];
printf("Enter the string:");
gets(name);
char ch = ' ';
int i,count=0;
for(i=0;name[i];i++)
{if(name[i]==' ')
count++;
}
printf("Number of words is %d",(count)+1);
}</pre>
-- modified 31-May-20 15:08pm.
|
|
|
|
|
This is something I hate, but it's idiomatic. A C string ends with the character NUL, whose ASCII value is 0, which is equivalent to false . So the loop ends when the character NUL (usually written as '\0' ) is encountered. The check is equivalent to
name[i] != '\0'
but some people hate typing so much that they write this kind of thing.
modified 31-May-20 15:49pm.
|
|
|
|
|
The for statement breaks down as three individual expressions:
for(set; while; do) :
Note that any of these expressions (or indeed all of them) may be blank.
In your code the expression in the while part is name[i] , which means while name[i] is true , or rather while name[i] is not equal to zero . Strings in C are (or should be) terminated with a zero character (NULL), so the expression will be true as long as the character in question is not the terminating NULL.
|
|
|
|
|
Can you pass an entry from the middle of the array as argument to a function?
void AFunction(int * ArrayItem, int size)
{
}
int TestArray[5];
AFunction(&TestArray[3], 5);
modified 31-May-20 15:28pm.
|
|
|
|