Forgot your password?
Sign in with
Article Help Forum
Submit an article or tip
Import GitHub Project
Import your Blog
Ask a Question
View Unanswered Questions
View All Questions
View C# questions
View C++ questions
View Python questions
View Java questions
All Message Boards...
Running a Business
Sales / Marketing
Collaboration / Beta Testing
Design and Architecture
Internet of Things
C / C++ / MFC
ATL / WTL / STL
Objective-C and Swift
Hardware & Devices
Hosting and Servers
.NET (Core and Framework)
Site Bugs / Suggestions
Spam and Abuse Watch
The Insider Newsletter
The Daily Build Newsletter
Most Valuable Professionals
Where I Am: Member Photos
The Insider News
The Weird & The Wonderful
What is 'CodeProject'?
Ask a Question
Bugs and Suggestions
Article Help Forum
Comments by den2k88 (Top 36 by date)
You are using CRT functions, those use the system locale to print characters. Check if you are using the en_US locale instead of ja_JP.
Refer to your Operating System documentation for how to change your locale.
There are reasons these are homeworks.
This is a good angle I didn't think of, thank you!
Actually all versions are downloadable for free and only the license tied to the account changes. In cases like this it is a reasonable assumption that the offered features depend on the subscription level.
VS is not banned on their site: I requested it and they delivered - but they themselves discovered they can't give me the license so I'm stuck with the 30 days trial.
Work is on their equipment but in my company's premises, but I'm working from home due to pandemic. Messy situation. I already spent 100$ to cable the house because I onbly had wifi and the suckers gave me a desktop PC without wi-fi. Since I was going to do it anyway (I wanted to move my net equipment in an area where the cat is allowed only under supervision) I didn't complain.
Well, I will embrace the suck. Thanks for the answer!
Situation is complex: the environment is not on VS at all, it's on an IDE for a very well known embedded system.
That IDE sucks. It *is* workable but to find answers that with VS+VAX it takes me 30 seconds, it requires me half an hour with the right IDE.
So I have no pressing need, the customer is stingy and my company is trying to win them because they are OEM manifacturer for a large market we're not into.
I cant fsck up in any conceivable way.
I upvoted and bookmarked it: I will probably need it in the near future and I would have stumbled upon the same obstacle :D
Most of the times the definition needs no change whatsoever. By having them separated it's fairly easy to check if different versions of the same software share the same interface to the class (single software with hundreds of branches tailored to the customers, each branch possibly coming from different versions of the base software).
One thing is the interface, the other is the code. While Interfaces solve the problem they are actually a tool thought for other purposes (defining precisely what a class MUST DO to fulfill its end of the "contract") instead of giving a quick summary of what operation does the class do, which operations are accessible from the outside world and which data does it hold.
Yes I knew them but they still keep together declaration and implementation. IMHO I'd end up hating them because instead of having a big book and an index (c and c++ way) I would end up with several booklets and no index whatsoever (partial classes).
It's not MEF that I need (though I'll bookmark it for future needs, thanks), the whole reasoning is under OG solution. I just like to split what to expect from how it is implemented, it's a way to have better documented code (i.e I explain what a class does and the logic of it in the header, then the gory details and suggestion for a better code in the implementation. Less clutter).
I normally use the header file to describe what to expect from a class, an index which me and my coworkers look and know instantly that this class has these methods, exposes those properties and defines these data types. If it's a derived class then it adds these methods and overrides these others. Then in the implementation file there are the gory details over which regions are useful and so on.
Partial classes are useful but still blocks comprising of both definition and implementation - there has been only a single instance in which I would have liked them in C++ though, splitting the implementation may lead to a bigger mess than before.
I guess I'll have to use interfaces for the needs I have but correct me if I am wrong, interfaces cannot declare nested types and data members, don't they?
At work we are forced to use VB6 and my colleague did the very same thing: no way to make it work under Win7 64 bit.
Please, please, please, sometimes a developer just don't have the choice. This answer bring no good to anyone...
Reason for my vote of 4 \n This translates roughly to "check for nulls before using values" which is something any programmer not born in the JavaNullPointerException era does as a mantra. Still it is a useful "watch out, nulls can be returned even wheter you don't expect".
My idea would be to loop asking 64 (or
) bytes and storing inside a buffer until either ReadFile returns FALSE or it reads less bytes than asked.
When you have to read an unknown amount of data it is the simplest way, and in many cases the only one.
Oh, sorry, I didn't look deeply in the article: it means the same as *& but in a C++/CLI (for .NET) context.
^ means the same as * but for a managed reference, while ^% means the same as *&. More on wikipedia: http://en.wikipedia.org/wiki/C%2B%2B/CLI
and MSDN of couse explains better (I have only a little experience with .NET).
Reason for my vote of 3 \n It's hard to define the performance of one environmnet towards the other with a "simple" math computation, especially using the same algorithm, since it will be compiled somewhat similarly.
When we speak about C performance we take into account the possibilites of manual optimization, for example many algorithms may be rewritten to operate sequentially on the elements of a matrix in order to have only one cycle and one advancing pointer into the memory (Sobel algortihm for example), meaning less computation of indexes and non sequential accesses to memory.
Also the insertion of intrinsics and assembly code, plus the unsafe typecasts, function pointer calls, memory zeroing, allocation/deallocation of memory managed focussed on the single application...
Of course many of these techniquese aren't easy, nor secure or general - they all are tradeoff for performances, which in some environments are as important as functional requirements due to timing contraints on the provided output.
Concluding, I think this article is conceptually flawed, but the author for sure put a decent amount of work in it and did a decent job.
Reason for my vote of 1 \n Plagiarism is well received on CP not.
Then broaden your horizons, look even outside your country - I am Italian, I am used to look abroad ;) improve your spoken and written English, maybe think about studying abroad, for example in Italy there are Politecnico di Torino (Polytechnique University of Turin) and Politecnico di Milano (Polytechnique University of Milan) that regularly accept foreign students from any part of the world and provide grants.
This two universities give a high chance of finding jobs worldwide, and the English taught lessons aren't particularly demanding, being that many professors aren't native speakers as well.
By the way, it is quite normal having fears before finishing school, we all passed through that :)
What is the expected result?
PS: next time don't write the title all in uppercase, it means shouting and it is rude.
I'm sorry but can you tell us something more? The question is poorly worded - what do you mean with "How Do I Get The O/P In Single Digit"?
More on ASCII vs UNICODE
Or, as the other users said above,
int WINAPI foo (LPSTR bla)
afer all WINAPI is just a define for __stdcall
Can you expand? It's hard to understand what you're asking. Also please include the code in a preformatted block and please indent it correctly.
This solution does exactly the same as putting the correct path in Additional Dependencies
Nope, it means one *match*.
fscanf("%d %d") for example returns 2 if it sees 2 integers, 1 if there is only one, 0 if none. It is not tied to the number of characters!
Aaaand the question would be? You posted this code extract in 5 questions with 5 different titles in the same number of different categories all of them this morning, which incidentally is the same day you subscribed. What are you trying to accomplish?
It is not a question of programming language: there are math function parsers for every language invented. The choice of the language and IDE is a matter of your liking.
I would suggest using C, C++ or Java because VB6 is "dead" (almost, there are a number of companies including mine where it is still widely used for production code) but it has some limitations that mede sense 15 years ago (and many not even then). Also your acquired knowledge will be more useful. Still, the quickness of VB6 for scrap projects is unmatched IMHO.
I comment myself: I though "function" as "subroutine that returns a value" not function as the mathematical element. Sorry!
Ok, right I got it - that was pretty tricky indeed. Good solution!
What problem did you have with '&&'? It should work fine, also it's not safe to use ungetc to undo a fscanf.
So you know it's shape. I'd say that either you try with the automatic learning project of OpenCV (I don't remember its name and I don't have OpenCV doc at hand nor free internet access, sorry for that) and a large number of samples - that would be the easy way since it requires little coding and headache or you start designing the logic to understand, based on the edges/contrasts/shape of the image if you are looking at a cooler o not.
That requires experience and a not trivial work to be done, but there are no other ways. Image processing is largely a non deterministic field.
EDIT: I found an answer on stackoverflow HERE http://stackoverflow.com/questions/6416117/simple-object-detection-using-opencv-and-machine-learning.
There are a little more accurate pointers than the ones I gave you before.
This is a clever (meaning pretty harsh) exercise. I think I have drafted a solution (not tested) but since it is a homework it is better to find the REASONING behind.
I assume this is a basic programming course, so I will use only basic instructions and will not focus on efficiency - it might complicate things a lot.
First thing, you are working with a string and searching substrings. So for the first thing you should scan the string char by char with a for cycle (let's say we use the variable i as counter).
Second thing, you obviously need to look subsequent characters in the string, so you will need a nested cycle (let's use variable j) that starst from the current value of the outer loop and scans until the end of the string, comparing the i-th carachet with the j-th.
Third, you need to find substrings, so you might need another nested cycle (let's use k) that when i-th and j-th characters are the same starts looking if the characters at the positions i+k and j+k are the same, and counts the equal characters.
Then, if you have more than 1 character you found the substrings. I left out most of the logic pointing out only the basic block-building reasoning behind the problem, the same reasoning I followed to draft the solution.
Think on this and try to write it down, see what goes wrong and do some trials, them eventually report us where you're stuck or wether you've benn successful.
Hope to be of help,
To make it work you should declare UniqueID in a .cpp (or .c) file, THEN refer to it with external in header and FINALLY including that header.
That is because whe you use the "extern" keyword you are substantially telling the compiler "look, somewhere in the code this symbol is defined so don't shoot an error right now and pass the job to the linker". But if that symbol is non-existant in any of the .obj files created by the compiler (and they depend entirely from the .c o .cpp files) it is the linker that issues the error.
Also, sorry for the dealy in the answer, I did not see your comment up until now.
That's a homework, I'd bet on it.
Anyway, what do you mean with "symmetric substring"? In which context? How is it made?
When you ask question be more specific, try things and tell us where you're stuck. We could even help with the reasoning behind, but this is not a code-for-free site.
What error does it give? Can you post a bit more of the surrounding code? Help us to help you!
Last Updated 1 Jan 1900
All Rights Reserved.