|
|
Definitely use a whiteboard or paper for architecting a complicated system (or a software tool like Visio). Last thing you want to do is spend a bunch of time writing software that doesn't really make sense in the grand scale of things (architecture-wise).
|
|
|
|
|
Albert Holguin wrote: Definitely use a whiteboard or paper for architecting a complicated system (or a software tool like Visio).
That is what I do when I say
PPolymorphe Wrote: I only resort to paper to draw diagrams when the current problem is complicated.
Albert Holguin wrote: Last thing you want to do is spend a bunch of time writing software that doesn't really make sense in the grand scale of things (architecture-wise). Can only agree.
Patrice
“Everything should be made as simple as possible, but no simpler.” Albert Einstein
|
|
|
|
|
ppolymorphe wrote: That is what I do when I say
PPolymorphe Wrote: I only resort to paper to draw diagrams when the current problem is complicated.
I was only agreeing/elaborating...
|
|
|
|
|
Ok then. English is not my primary language and sometimes, I miss things
Patrice
“Everything should be made as simple as possible, but no simpler.” Albert Einstein
|
|
|
|
|
Academic point of view:
You should avoid using autocomplete or similar helpers so that you can have better hands-on.
Professional point of view:
You should not miss any helpers (autocomplete, automation etc.) so that you become more productive.
Best wishes
|
|
|
|
|
#include<stdlib.h>
#include<stdio.h>
struct tree
{
char info;
struct tree *left;
struct tree *right;
};
struct tree *root;
struct tree *stree(struct tree *root,struct tree *r,char info);
void print_tree(struct tree *root,int l);
int main(void)
{
char s[80];
int l=3;
root=NULL;
do
{
printf("enter a letter:");
gets(s);
root=stree(root,root, *s);
}
while(*s);
print_tree(root,0);
return 0;
}
struct tree *stree(struct tree *root,struct tree *r,char info)
{
if(!r)
{
r=(struct tree *) malloc(sizeof(struct tree));
if(!r)
{
printf("out of memory \n");
exit(0);
}
r->left=NULL;
r->right=NULL;
r->info=info;
if(!root)
return r;
if(info<root->info)
root->left=r;
else
root->right=r;
return r;
}
if(info<r->info)
stree(r,r->left,info);
else
stree(r,r->right,info);
return root;
}
void print_tree(struct tree *r,int l)
{
int i;
if(!r) return ;
print_tree(r->right,l+1);
for(i=0;i<l;++i)
printf(" ");
printf("%c \n",r->info);
print_tree(r->left,l+1);
}
|
|
|
|
|
You need to use your debugger to gather more information about what happens when you run the code.
|
|
|
|
|
Ditto what Richard suggested.
Printing aside, you need to first verify that the tree is being built correctly. The only way to do that is to single step through each line of code (the stree() function) using the debugger. Note the values of info , left , and right along the way. As you build the tree on paper, what you see in the debugger should match.
Are you trying to print the tree contents pre-order, in-order, or post-order?
"One man's wage rise is another man's price increase." - Harold Wilson
"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
"You can easily judge the character of a man by how he treats those who can do nothing for him." - James D. Miles
modified 20-May-16 16:09pm.
|
|
|
|
|
You should learn to use the debugger as soon as possible. Rather than guessing what your code is doing, It is time to see your code executing and ensuring that it does what you expect.
The debugger allow you to follow the execution line by line, inspect variables and you will see that there is a point where it stop doing what you expect.
Debugger - Wikipedia, the free encyclopedia[^]
Mastering Debugging in Visual Studio 2010 - A Beginner's Guide[^]
Patrice
“Everything should be made as simple as possible, but no simpler.” Albert Einstein
|
|
|
|
|
Hi; i m just confused about defaulting arguments.can someone simply explain defaulting arguments
|
|
|
|
|
See here.
"One man's wage rise is another man's price increase." - Harold Wilson
"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
"You can easily judge the character of a man by how he treats those who can do nothing for him." - James D. Miles
|
|
|
|
|
It's simply a means to provide values for the arguments that will be a good default (or starting point).
For example, if let's say... you're opening a socket to provide some service. By default, most libraries will bind to any (or every) Ethernet address available on a system. Reason you'd want to do this is because you don't necessarily want to only provide the service on one Ethernet device but not the other (for example, servers have multiple Eth devices for load balancing). If however, you do only want the service to be provided on one device, then you can choose to bind to the specific Eth address of interest.
|
|
|
|
|
Does wp_cache still load Wordpress and use MySQL?
|
|
|
|
|
See here.
"One man's wage rise is another man's price increase." - Harold Wilson
"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
"You can easily judge the character of a man by how he treats those who can do nothing for him." - James D. Miles
|
|
|
|
|
How to pass Array[Seq[String]] to apache spark udf? (Error: Not Applicable)
|
|
|
|
|
Is this a C / C++ / MFC question?
"One man's wage rise is another man's price increase." - Harold Wilson
"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
"You can easily judge the character of a man by how he treats those who can do nothing for him." - James D. Miles
|
|
|
|
|
How to organize nested props in VueJS?
|
|
|
|
|
See here.
"One man's wage rise is another man's price increase." - Harold Wilson
"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
"You can easily judge the character of a man by how he treats those who can do nothing for him." - James D. Miles
|
|
|
|
|
Thank you very much
|
|
|
|
|
I've used SendMessageW API to direct an EM_SETSEL message to
a designated Edit control to make it locates the searched text
entered from the another Edit control. Why it doesn't provide
visual feedback to reflect its current state?
I used Spy++ to detect the EM_SETSEL message and the message
was correctly listed in the message window.
Can anyone give suggestion?
My current development tool is MSVS Community 2015, project type is Win32 that merely uses A.P.I.
modified 19-May-16 13:01pm.
|
|
|
|
|
I have just tried this (with VS 2010 Express) and it selects and highlights the text correctly. Can you show the exact code you are using?
As a suggestion, do not use the A or W suffixes on Windows API calls. Use the base name, without the suffix, and let the compiler generate the correct call based on your projrct's Unicode/ASCII setting.
|
|
|
|
|
I've tried to omit the suffix letter and it still produced the same effect.
Below is code that sends the EM_SETSEL message to the Edit control.
int selPos = (int)(pInitialFound - lpWStr1) + 1;
int selEnd = selPos + (lstrlenW(lpWStr0));
SendMessage(hwndEdit, EM_SETSEL, selPos, selEnd);
Are there any suggestions to better correct that problem?
modified 19-May-16 13:02pm.
|
|
|
|
|
programmingalholic wrote: I've tried to omit the suffix letter and it still produced the same effect. That's because the A or W is nothing to do with your problem. That is just a suggestion for better code writing, and you should fix it in all your programs.
As to the actual problem, what are the values of selPos and selEnd when the code runs?
|
|
|
|
|
The selPos is the value denotes the first character's position of the selected text and the selEnd is the value denotes the end character's position of the selected text.
Did any VS.Community users have the same experience like me?
|
|
|
|