Click here to Skip to main content
15,356,336 members

Comments by merano99 (Top 176 by date)

merano99 yesterday View
The buffer can be any length, just read the manual.
Someone who claims to have more than 20 years of C experience shouldn't have to ask such questions...
merano99 yesterday View
Yes, partially correct. Since I don't use Code::Blocks I can't say exactly what should be there. solution updated.

Note: I would advise against using multibyte strings.
merano99 yesterday View
This looks to me like there is at least one 0 missing at the end (nNumberOfBytesToRead). In any case, this is usually not in a file.
merano99 yesterday View
In sizeof(lpBuffer) lpBuffer is a pointer that is certainly longer than 8, depending on the system. But of course you are right in saying that the pointer should be initialized, meaning it should point to a buffer of sufficient size.
merano99 3 days ago View
Yes, possibly. I don't know why anyone would have to change more than 100 functions either:-D
merano99 3 days ago View
Please show your existing work.
DataView.Sort sounds like C#, why are you asking about C?
merano99 5 days ago View
merano99 5 days ago View
The code is obviously pure C. Since the article was additionally tagged with C++ and boolean, very different answers can result and cause confusion.
merano99 5 days ago View
Yes, auto should always match since the compiler sticks to the declaration.
merano99 5 days ago View
You're right when you say that error handling is still completely missing. Even system calls should check by checking the return values. For the sake of clarity, the test in forums is often initially omitted. When debugging, however, they often do a good job. (5+)
merano99 5 days ago View
For system calls like Write File(), I recommend using exactly the variable types that are intended for here. A C++ data type does not fit here!
merano99 5 days ago View
Comments cannot be rated here. My solution is currently the only one. If the error with the ampersand wasn't a careless mistake, I would recommend improving C or C++ a bit.
merano99 5 days ago View
No, it could have been coded like that in the early 80s. I gave Richard's dynamic solution a 5, but I also wanted to offer a simple alternative here with only one malloc.

The Task was to store names in one dimensional array. See Title.
merano99 29-Jun-22 1:55am View
I always find it a pity when no solution is found for questions. Basler cameras, for example, are not so rare that someone will not need the solution at some point.
That a valid solution could lead to a ban would surprise me.

If the Answer does solve the problem vote and accept as solution.
merano99 29-Jun-22 1:08am View
You cant do this easily, i already told you:
L"\xef\xbb\xbf - hello - J - こんにちは - abcdefghijklmnopqrstuvwxyz",
merano99 28-Jun-22 20:25pm View
Unfortunately, the result at i != 0 is wrong and thus does not have the same effect at all.
If you look at the generated code, there is no question of saving, on the contrary.

A look at the generated assembler code shows that the creative coding rather means more effort and is also more difficult to understand for humans.
for (int i = S.size() - 1; i >= 0; i--) {
00A17B45 83 E8 01             sub         eax,1  
00A17B48 89 45 D4             mov         dword ptr [ebp-2Ch],eax  
00A17B4B 83 7D D4 00          cmp         dword ptr [ebp-2Ch],0  
00A17B4F 0F 8C A2 00 00 00    jl          $LN13+2Bh (0A17BF7h)

for (int i = S.size() - 1; ~i; i--) {

00A07B45 83 E8 01             sub         eax,1  
00A07B48 89 45 D4             mov         dword ptr [ebp-2Ch],eax  
00A07B4B 8B 45 D4             mov         eax,dword ptr [ebp-2Ch]  
00A07B4E F7 D0                not         eax  
00A07B50 85 C0                test        eax,eax  
00A07B52 0F 84 A2 00 00 00    je          $LN13+2Bh (0A07BFAh)

(not optimized code, as you can see)
merano99 28-Jun-22 17:13pm View
I Think converting BOM48 to wstring will not work at all.
    unsigned char BOM48[3]{ 0xef, 0xbb, 0xbf };
    bErrGHJ = WriteFile(hDFile, (LPCVOID)BOM48, (DWORD)sizeof(BOM48), &dwBytesWrittenXPP, NULL);

    do {
        wstring write_stuff77 = L"XYZ";

        // Convert to two LPCVOID.
        // LPCVOID Nf2 = (LPCVOID)&write_stuff77[0];  NO!!
        LPCVOID LpAll = (LPCVOID)write_stuff77.c_str();

        // wstring wstrFirst(static_cast<const wchar_t*>(Nf1)); !!JUST DONT DO THIS!

        Bytes_that_need_To_Write = write_stuff77.size() * sizeof(write_stuff77[0]);

        bErrGHJ = WriteFile(hDFile, LpAll, Bytes_that_need_To_Write, &dwBytesWrittenXPP, NULL);

        bytes_which_have_written_already += dwBytesWrittenXPP;

    } while (bytes_which_have_written_already < Bytes_that_need_To_Write);

    bErrGHJ = CloseHandle(hDFile);
merano99 26-Jun-22 5:47am View
Thanks for the hint. With some programs you can switch on the writing of the BOM under options. In fact, e.g. Chinese characters are sometimes still not displayed correctly. Notepad++ and Firefox understand it and even my Visual Studio has no problem with the UTF-8 BOM.
merano99 26-Jun-22 3:39am View
I'm glad that there is now a solution as requested. Congratulations on the success!

Be careful when using C++ Datatypes with System-Calls.
//BOOL bErr = WriteFile(hFile, (LPCVOID)&write_stuff[0], sizeof(wchar_t)*write_stuff.size(), &dwBytesWritten, nullptr);
BOOL bErr = WriteFile(hFile, (LPCVOID)write_stuff.c_str(), write_stuff.size()*sizeof(TCHAR), &dwBytesWritten, NULL);

I didn't take care of the file format myself. When I got the special character pasted by copy and paste, the Visual Studio code editor changed the file format to include special characters can be saved.
It's not a good idea to edit code with a text editor like Wordpad, though the code that initially looks correct can contain invisible special characters that subsequently disrupt the compiler.
I edit source texts preferably with the associated development environment (IDE) or with Textpad or Notepad++. Textpad notices that special characters are included and offers to "convert" them, the special characters are then either gone or changed. Notepad++ seems to interpret and preserve the special characters correctly.
Windows tries to associate the file format with the extension. If you have an unfavorable or wrong link here, there will be problems. The problem arises here because a source file does not have a header in which the format is clearly defined. In contrast to graphics files, an editor then has to guess the format or rely on the extension. I've been wondering if there's anything wrong with that. It just grew that way historically and is no longer easy to change.
I took a closer look at the file format chosen by my IDE for the demo.cpp. The source text with special characters was encoded in UTF-8.

Please rate the (both?) solutions mark as solution. For further questions better open a new topic.
merano99 25-Jun-22 16:33pm View
Thanks, I had overlooked this time.
merano99 25-Jun-22 5:16am View
updated my solution
merano99 24-Jun-22 20:46pm View
In a wstring object, the string is stored as wchar_t*, so you can assign it, or specify it directly at creation.
wchar_t* test1 = TEXT("Test");
wstring test2(test1);
Which compiler and version do you use exactly?
merano99 24-Jun-22 18:59pm View
What flags are you using? For gcc -std=c++03 ? It may be that additional effort is necessary for older versions.
merano99 22-Jun-22 11:10am View
+5; works with /EXPORTS
merano99 18-Jun-22 2:43am View
All correct. It should be added that it is not good to name all variables V, moreover in upper and lower case.
A char is usually written with the variable name c. (+5)
merano99 17-Jun-22 16:56pm View
What exactly should the program do? Should the polynomial be read in and should polynomial operations be executed or should x be calculated for the polynomial?
merano99 16-Jun-22 16:19pm View
The source code is clearly C++, but tagged as C.
Because of the many invalid codes, it will not show anything until the code is corrected.
merano99 15-Jun-22 12:00pm View
Isnt this a for loop?
int k = 0;
while ( (k+l) <= N) { ... k++;}

for(k=0; (k+l) <= N; k++){..}
merano99 12-Jun-22 9:01am View
Before realloc, malloc also goes wrong in this function:
merano99 10-Jun-22 17:22pm View
merano99 10-Jun-22 16:29pm View
Better to use an STL container, no cleanup needed and resizable if needed.
In addition, range-based for loops are supported.
merano99 9-Jun-22 14:39pm View
You write: "some code I haven't learn yet so my homework not allowed me to use it."
Although the question is tagged C++, this is currently pure C, not C++. Is a C++ solution possible? What exactly are the permitted means, what are the restrictions on homework ?

Something else:
The fact that large parts of the specifications were exchanged after there were already proposed solutions is really unpleasant. It would be better to add more info, or leave the original question and create a new one.
merano99 6-Jun-22 13:20pm View
it works, +5
merano99 5-Jun-22 12:56pm View
If my post helped, it would be nice if it were marked as a solution.

merano99 4-Jun-22 14:37pm View

Springs: 2 5 1 7 4 9
Rock no: 1 2 3 4 5 6 7

Where exactly is the target?
Shouldn't the panda be at the target here after 4 jumps?
From 1-3, 3-4, 4-5, 5-Target
merano99 3-Jun-22 11:05am View
Too bad. Microsoft documents it like this:
merano99 3-Jun-22 10:29am View
Did you consider that?
if (root->info < min) {
min = root->info;
ch = root->ch;
This matches my suggestion, which would also be more efficient, since less code, computational effort and time. Please mark my solution as solution.
merano99 2-Jun-22 18:09pm View
The first solution would be doing the same work twice. That doesn't seem very efficient.
merano99 2-Jun-22 17:55pm View
Asking for an idea for a project would have been acceptable, but asking for a solution so boldly and directly is unacceptable.
merano99 1-Jun-22 17:55pm View
Apparently the questioner is not interested in a working solution to his question. I'll give you another 5
merano99 30-May-22 18:24pm View
Are you shure? average = *sum / 2;

I would suggest to use the vector in a class, and not as parameter.
merano99 30-May-22 2:17am View
merano99 26-May-22 2:02am View
also 5
merano99 26-May-22 1:07am View
Right, the heading with multidimensional arrays (matrices) surprised me too.
Perhaps the original plan was to first write the 68 words, each with a maximum of 40 bytes, into a char matrix?

Top tutorial Patrice, my 5 for that.
merano99 25-May-22 20:59pm View
I would expand the list a bit more to accomplish the task:
5. Find the beginning and end of a word
6. Output of a substring with one word
7. Programming a loop that prints the words in the desired order.
(Alternatively, advanced programmers could choose recursive output.)
merano99 25-May-22 19:43pm View
There are many reasons to learn C or C++.

I think it's nonsense that C can only really be used for maintenance.
Whether this exercise is too difficult for a beginner depends on whether the problem can be broken down into small enough simple steps. That would be what you always need, regardless of a programming language.
merano99 20-May-22 18:08pm View
This is clearly Java. A C or C++ Program starts with int main().
The question doesn't belong in this forum or the code is wrong.

merano99 20-May-22 17:58pm View
It is the right solution to remove the last lines.
merano99 12-May-22 19:41pm View
5, The real way to do this.
merano99 8-May-22 16:30pm View
The code snippet is .Net/CLI. Is help needed based on this, or should C++ be used?
A more detailed description of the desired functionality is probably required.
From the existing text I would assume that several form pages should be programmed, each with a forward and back button. For example, MFC AppWizard would generate something like this if you select property sheet with wizard mode.
merano99 7-May-22 20:24pm View
Since the solution works, you get my 5, but I would prefer a pure C++ solution.
merano99 24-Apr-22 6:53am View
Code is incomplete. Missing struct student and substruct mark.
merano99 22-Apr-22 15:03pm View
Show us your source code and ask specific questions about it. There will be no solution service here.
Note on the solution here: The numbers should only be output, storing all numbers in an array does not seem to be required.
merano99 22-Apr-22 12:53pm View
In this particular case, it's an easy task. Almost no feature of C++ is used. What the many C++ includes are there for is not clear. There was someone at work who didn't exactly know what he was doing.
merano99 22-Apr-22 12:48pm View
I am of course aware of this fact. However, a solution can also be used for learning. Anyone who tries to get along with copy & paste is neither willing to learn anything nor has they understood anything.
A turnkey solution that can be handed over directly without any personal contribution would really not make sense here. I agree.
merano99 21-Apr-22 18:48pm View
To be able to output m_name with cout, m_name.c_str() might be necessary.
merano99 21-Apr-22 18:38pm View
Almost fine, but would have a two comments:

1. The compiler complains about the const declaration: this pointer cannot be converted from "const person" to "person &".

2. Missing <string> include and code should use std::string.
merano99 16-Apr-22 4:07am View
Remove your code here and improve your question above with it. Please use C code tags.
merano99 16-Apr-22 4:05am View
Remove your code here and improve your question above with it. Please use C code tags.
merano99 15-Apr-22 13:27pm View
I would also accept your assumption that a copy'n'paste job went very wrong here. Someone who doesn't see this at first glance probably doesn't know exactly what he's actually doing. Apparently some lines of code have been duplicated and copied into each other. Nobody can read it like that. I removed the obvious duplicates and made small changes. The code looks like a typical Arduino program. Apparently other important information is missing as well.
Since we don't know exactly what the problem is, we can't go any further here without the author writing where exactly the problem is. After the rearrangement, the program can now be compiled without any problems...
merano99 15-Apr-22 6:10am View
The author seems to be very unclear here: The task was actually "You are given a 3x3 matrix", but it was
declared differently here. How the syntax of C works is also extremely unclear. Under such conditions it's
going to be a challenge. Nothing is said about the mathematical background.
merano99 15-Apr-22 3:54am View
Thanks! Allocate the memory is simple: *nbuf = (char*)malloc(length + 1);
merano99 14-Apr-22 21:17pm View
The GetComputerNameExA() function works fine in a DLL. Provided that the text fits in the buffer and the terminating 0 is present. The Function strlen can kill your program at this point. I would suggest only write: buffer[length] = 0;
merano99 13-Apr-22 11:16am View
Its your Code, so its up to you to learn that this does not what you want.
case1:cout<<"balance is"<
merano99 10-Apr-22 5:33am View
+5, see comment in my solution
merano99 7-Apr-22 20:06pm View
You mean VMR, right?
merano99 3-Apr-22 19:57pm View
How the value 10 is calculated in the example is unclear. How exactly is the example calculated?
merano99 25-Mar-22 22:36pm View
kbhit (conio.h) it is not only available at Borland.
merano99 15-Mar-22 17:38pm View
very nice solution. (my 5)
To calculate a tip with range i would suggest
int GenTip()
std::random_device rd; // define random device
std::mt19937 gen(rd()); // seed the generator
std::uniform_int_distribution<> distr(0, 10); // define the range
return distr(gen); // generate number

Note: the solution functionally covers the task well, but the reference to the circular linked list doesn't seem to be fulfilled?
"(i)Code the above scheme in C++, insert 0 when initializing circular linked list."
On the other hand, a circularly linked list would hardly be sortable.
It is unclear what the task giver was thinking.

You accept negative tips?
merano99 8-Mar-22 18:29pm View
Richard had expressed the assumption that you are opening a modal dialog that cannot easily be minimized.
But we don't know what the dialog is used for, why it needs to be minimized and ultimately whether it should be a dialog at all. One might also ask why a modal dialog is used and not a non-modal one, or the other way around, why would you want to minimize it. There are many possibilities to change something here and the statement that it is not possible is not true with some certainty.
merano99 28-Feb-22 18:11pm View
OK. Didn't think the solution was that simple. I wrote this as a solution. I would be happy if the solution is accepted.
merano99 25-Feb-22 18:18pm View
Did you try SetBkMode(hdc,TRANSPARENT); ?
merano99 24-Feb-22 18:33pm View
If a Python solution is desired, why is the question also marked as C++?
Completely different solutions could possibly be considered here.
merano99 7-Feb-22 17:13pm View
Only a few letters wrong, see my solution:-)
merano99 6-Feb-22 18:43pm View
You tagged the Question with many Tags: C++, C#, QT
The techniques are not compatible and, moreover, one could propose a solution with Win32 or MFC or .NET for C++ alone. It is best to show the existing code and only use tags for techniques that should also be used.
There is not enough information to be able to help here.
merano99 1-Feb-22 18:41pm View
But that would be part of the task anyway: "Has appropriate getters and setters"
merano99 25-Jan-22 14:59pm View
What does the compiler say?
Everything is required except for the one line with PrepareFaceBank(std::string Path). The prototype should actually be somewhere. However, it is not in the linked document.
In addition, you should write a function yourself that frees up the memory. For testing, it should run like this.
merano99 25-Jan-22 10:37am View
I've just adjusted my suggestion a bit so that it compiles without errors.
merano99 25-Jan-22 9:06am View
See my solution for a wrapper that wraps the C++ data for delivery via a C DLL. Someone in the .NET forum probably knows how to unpack it in C#.
merano99 22-Jan-22 19:51pm View
What is your Question?
The task would be to read the text row by row, since the row number should be output.
merano99 12-Jan-22 16:59pm View
When the Program crashes bevor the loop the static array
struct star s[201][201];
and other local stuff is possibly to much for your Stack.
merano99 8-Jan-22 19:50pm View
I suggest providing the option of specifying the number of rooms in the constructor.
Floor::Floor(int nrooms=0): available_rooms(nrooms){ }
merano99 3-Jan-22 16:25pm View
"I tried to solve this code ..."
Please show the code so we can talk about it. Without an approach, you usually can't go any further here.
merano99 2-Jan-22 20:02pm View
In atlstr.h you will find:

Line 1296 - typedef CAtlString CString;

so why not use CString?
merano99 2-Jan-22 19:54pm View
MFC and ATL are both included in the free Visual-Studio Community Edition.
I can't say whether the atlstr.h could be used with a compiler other than Visual-Studio. You will surely be able to look at the headers.
(By the way: Fortunately, the times of the cropped express versions are over.)
merano99 28-Dec-21 20:22pm View
To save and load a string, I would use a string instead of
char value[value_size+1];
You would then no longer have to worry about the length.
merano99 13-Dec-21 16:48pm View
Since the field starts at 0, the last index should not be larger than (max_size-1).
size = diap("Input size-->", 0, max_size-1)
merano99 13-Dec-21 15:55pm View
The code could fit this project:
A Simple Pie Chart Control - Improved 3-D Pie Chart by PrasadPerera

BOOL CPieChartWnd::Create(LPCTSTR lpCaption, const RECT& rect, CWnd* pParentWnd, UINT nID);

merano99 7-Dec-21 18:04pm View
As I have already written in my solution, this is not C ++ code and that it is rather unsolvable with a stack has already been written.
Please comment on the existing solutions and, if necessary, evaluate.
merano99 6-Dec-21 11:10am View
Displaying a message box with [Afx] MessageBox is a blocking operation, so it is normal.
Are you sure that the dialog is not behind other Windows, e.g. behind the IDE window?
merano99 29-Nov-21 17:21pm View
The input appears to be read from a file. The attempted solution shown here has little to do with the task and is far too little. In addition, there are no specific questions with which one could help.
merano99 29-Nov-21 16:28pm View
Windows that are closed do not generate any more messages. You could just leave the vector element unused.
Before you finally close the window you can of course delete the element from the vector, but you would then have to renumber all remaining windows.
To do this, you would have to write the window handle in the vector. But if this is needed anyway you can save the numbers completely. Simply search for the window handle and use the data under this index element.

merano99 29-Nov-21 16:21pm View

Windows that are closed do not generate any more messages.
Before you finally close the window you can of course delete the element from the vector, but you would then have to renumber all remaining windows.
To do this, you would have to write the window handle in the vector.
But if this is needed anyway you can save the numbers completely. Just find the window handle and use the index of that element.
merano99 28-Nov-21 17:03pm View
Numbering the windows with SetWindowLongPtr () seems to be a good solution if you write a consecutive number after creating the window. It is unclear which information should be stored in data.
merano99 27-Nov-21 6:46am View
Are you shure that this code compiles?
I think several places will not:
reinterpret_cast<char *="">
no.="" "<<acno;
merano99 26-Nov-21 19:53pm View
In addition, it would be much better not to declare data public but rather private.
merano99 26-Nov-21 19:51pm View
I fully agree with you. Before you overwrite the old pointer, you should definitely check whether you don't have to free up the memory beforehand.
merano99 15-Nov-21 18:52pm View
//code the 10 functions that are suppose to be coded ....

If you have tried, where are they?
merano99 13-Nov-21 3:30am View
If you solved it in Java what exactly is the problem. The algorithm will probably not differ much, just the syntax.
We usually expect some visible personal contribution here.
merano99 11-Nov-21 15:53pm View
We would expect there to be a first program framework where some things have already been prepared.
Should it get caught somewhere, we would expect that the problem is described here and explained what does not work as desired and what you actually want.
It would then also be good to ask a specific question here.

What does Page 2 of 6 mean?
merano99 6-Nov-21 13:20pm View
If you accept a variable length list, you cannot hardcode 3.
See my answer on a variable number of elements.
merano99 6-Nov-21 12:56pm View
It seems that the hard coded 3 is the real problem.
Another problem arises when someone enters two words with spaces. It would make sense to read in the entire line with getline.
merano99 6-Nov-21 9:05am View
It definitely works.
Did you assign the return value in main as I suggested?

n = getBankinfo();
merano99 5-Nov-21 21:21pm View
If you had said from the beginning what exactly you are allowed to and what not you could have given better answers immediately.

When you have to use * as reference you have to write:

void displayBankinfo(Bankinfo *n) {
cout << n->name << endl;
merano99 5-Nov-21 19:03pm View
Yes, and in addition, it is better to move all of this to a subroutine.
merano99 4-Nov-21 14:35pm View
As you can see from our discussion below, there is no known C ++ solution to this frequently asked question. Under Windows there are solutions in C that also work under C ++.
merano99 4-Nov-21 14:25pm View
Out of desperation, because at this point it is neither platform-independent nor with "real" C ++.
If you don't like conio like me, I only see the possibility to use system calls directly. Unfortunately, it then becomes quite cumbersome. I also offered the solution here, see there.
I am not aware of any solution with cin that works without <enter>.
merano99 3-Nov-21 18:03pm View
The linked artikel is using <string.h>. It works, but <string> would be the first choice for C ++.
merano99 3-Nov-21 17:48pm View
1. Before delete you have to copy
2. Use memcopy instead of the for loop; that goes much faster
merano99 1-Nov-21 8:32am View
The Russian texts are comments generated by the Russian IDE. For me, German is usually also used in these places.
merano99 31-Oct-21 21:41pm View
The functions drawPoint() and cycle() are not used, variable totalPoints not defined.
Call of drawPoint(100, i, totalPoints) does not match declaration.

Better to use cmath instead of math.h.

#include <cmath>

A timer is probably needed that calls OnDraw regularly by callin e.g. InvalidateRect().
merano99 30-Oct-21 18:50pm View
Better not to use system("pause").


Instead write a function pause() with cin.ignore() and cin.get().
merano99 21-Oct-21 17:54pm View
Why not use

cout << "Enter element " << i << "\n";

Definition of arr is a problem here. In Your Solution this is not solved and
you missed to tell.
merano99 20-Oct-21 16:58pm View
If you only use Visual Studio the solution is ok.
If the lib should also be usable for compilers other than Visual Studio, it would be advisable get rid of name mangling (also name decoration).
merano99 18-Oct-21 17:22pm View
We discussed that yesterday. Havent you seen that?
merano99 18-Oct-21 17:16pm View
Instead of doing an idiot check, it might be better to use data types that avoid this.


int GetDaysInMonth( int year, TYP_MONTH month);
merano99 10-Oct-21 4:22am View
If C++ ist allowed, combine it with the solution from CPallini and you have a nice Solution.
merano99 10-Oct-21 4:20am View
You marked this as C ++, but you are writing pure C code. If C ++ is allowed, the solution from KarstenK would be recommended, otherwise that from CPalini.
merano99 10-Oct-21 4:11am View
In C ++ it is common to use <iostream> instead of <stdio.h>.
merano99 9-Oct-21 4:09am View
I don't see any reason to cross out the entire solution.
The correct spelling of COleDateTime and the link to the documentation are important parts of the solution.
merano99 8-Oct-21 16:30pm View
As you have noticed, it works with a small example, but it is generally unusual and not recommended, as it causes problems with linking in larger projects.

See: What to put in a header file?
merano99 8-Oct-21 14:00pm View
Ok. Then see my solution.
merano99 8-Oct-21 13:54pm View
see my update above
merano99 7-Oct-21 18:17pm View
If I understand the linked documentation correctly, there are COleDateTime Relational Operators

bool operator==(const COleDateTime& date) const throw();
bool operator!=(const COleDateTime& date) const throw();
bool operator<(const COleDateTime& date) const throw();
bool operator>(const COleDateTime& date) const throw();
bool operator<=(const COleDateTime& date) const throw();
bool operator>=(const COleDateTime& date) const throw();
merano99 6-Oct-21 19:17pm View

Are you serious?
merano99 6-Oct-21 19:12pm View
Are you serious?
merano99 28-Sep-21 18:10pm View
merano99 27-Sep-21 18:33pm View
The function pthread_create looks like POSIX. Since you marked the code as Linux, you should link with -lpthread and maybe you need -lm as well.
merano99 27-Sep-21 18:23pm View
Thank you.
merano99 26-Sep-21 19:59pm View
Shouldn't the result be in arr1?
merano99 24-Sep-21 18:49pm View
The approach is correct, but something goes wrong in the lower part.
It could possibly go like this.

// find base tens
if (number > 19) {
base = number / 10; // base = 3 tens
cout << tens[base] << " ";
number = number % 10; // number = 7
// find units up to 19
if (number > 0)
cout << units[number];
merano99 26-Aug-21 11:04am View
Yes, I saw that. But also: Updated 15 hours ago.
And since there was no answer, I decided to suggest something to solve that.

merano99 25-Aug-21 19:22pm View
Show the program you tried and explain where the problem is.
merano99 18-Aug-21 17:58pm View
Yes you are right. The text has been shortened and there is still an open if bracket in the original. I added. I´m not shure what it does. The suggestions in your solution would certainly be clearer.
merano99 16-Aug-21 14:38pm View
The source code at hand is pure C. Why is it tagged as C ++?
merano99 2-Aug-21 20:13pm View
hihi;) intiCount is missing a space: int iCount
merano99 1-Aug-21 18:11pm View
The Titel ist: "How to use a string instead of a hardcoded value"
The file name is in a variable - in a string, and is therefore very easy to change. It was precisely about the remaining conversion problem, which I believe to have elegantly solved here. I don't think the downvotes are justified.
merano99 31-Jul-21 19:21pm View
The best thing to do would be to write don't care code that works with both.
See my Solution.
merano99 31-Jul-21 6:53am View
You ask for "simple marksheet program in c#".
Why do you post this with C and C++ Tags?
Please remove the Tags that you dont mean.
merano99 28-Jul-21 17:12pm View
Essential parts of the source code are missing. It cannot be compiled without knowing the exact declaration for the self-defined data types.

error C2065: "str": undeclared identifier
error C2065: "listNode": undeclared identifier
error C2440: "Initialization": "str" ??cannot be converted to "listNode *"
merano99 28-Jul-21 16:58pm View
Edit controls are designed to either interpret Enter key presses as a new line (in a multiline edit control) or to ignore it. The way would be to subclass the edit control and call SetFocus () there. This then triggers the desired KillFocus message.
merano99 27-Jul-21 18:10pm View
You should add ios :: in as you read., ios::in | ios::ate | ios::binary);
merano99 13-Jul-21 18:35pm View
"I tried all of things but it doesn't work"

Show us what you have tried und tell us what does not work.

To start, you'll take a hello world program, declare some data types, and assign user input. Where is the problem?
merano99 12-Jul-21 15:05pm View
I used VS2015 german version and testet your Problem in InitInstance().

The Call of
SetWindowText( m_pMainWnd->m_hWnd, _T("Hello Wörld!"));

changed the TitleBar of the main window has as expected.

I used the System call here, not the MFC call. Is there a diffence?

Can you post a link to your code?
merano99 10-Jul-21 7:06am View
As I wrote hours ago, the file is not read at all. See my solution below.
merano99 1-Jul-21 19:26pm View
It is not clear where exact the problem is. We do not have the files "connec.txt" and "mesh.txt" and the compiler does not see errrors.
merano99 30-Jun-21 17:47pm View
To access HKLM (HKEY_LOCAL_MACHINE) you need admin rights, e.g. elevate your application using UAC. You can also allow access to the Key by editing the permissions on the relevant registry key.
merano99 23-Jun-21 18:36pm View
Code has several warning and space for better

1. // missing header
#include <string>
2. // convert string toupper
string type; cin >> type;
for (auto & c : type) c = toupper(c);
2. // conversion problems
par = lround((work[coun] - 40) * 1.5*fixed[coun]); // round
3. // variables not initialised
int coun = 0;
merano99 11-Jun-21 18:57pm View
You are asking for a solution for Arm assembler but you also propose various Intel assembler solutions. The difference is obvious, but it doesn't seem clear to you. A little more preparatory work would be necessary here.
Solution one, three and four even seem to come from the DOS era, that was a long time ago and makes little sense here ...

Why this was marked with C and C ++ here is also not clear to me.
merano99 10-Jun-21 20:19pm View
"set it to the appropriate value for the condition of not raining ..."
You screwed up.
merano99 7-Jun-21 19:43pm View
Wondering why there is old C Code in this C++ Program.
Would expect:

typedef std::deque<char> ListNode;

class Solution {
Solution(std::string text);
bool lsPalindrome();
ListNode _head, _reversed;
merano99 31-May-21 18:22pm View
What is "libraries.h" ?
merano99 29-May-21 15:22pm View
You're right, but the original question has recently been changed. That made her stand up again. Thanks for the hint.
merano99 27-May-21 19:23pm View
If you change to char *find_char(char c, const char *s)

C Compiler says:
warning C4090: "return": different "const" qualifiers

C++ Compiler says:
error C2440: "return": "const char *" can not converted to "char *".
merano99 20-May-21 19:43pm View
error C2065: "greater": undeclared identifier
With other header would work for me.
// #include <algorithm>
#include <functional>

Note: A set cannot store duplicates. Ignoring duplicates was not required here.
merano99 19-May-21 14:30pm View
Maybe some invisible characters in line 4. Copy the text into a simple editor (notepad or something similar) and save it again.
merano99 10-May-21 16:21pm View
It was intended as an addition to your approach, not a correction.
merano99 9-May-21 18:32pm View
When it ppsn is an char-array following is also not korrekt:
int checkPpsn(int ppsn)

Some datatypes should better be integer.
Effort and performance in the string comparison are not optimal.

Another point is the use of unsafe functions that are no longer common these days.
If you dont care use #define _CRT_SECURE_NO_WARNINGS
merano99 7-May-21 19:40pm View
The Compiler reports several problems, but at least it runs with 32Bit. First is that glut.h is not found. Ich used freeglut.lib instead. Missing braces, and Codelines, that make no sense like: "sprintf(text, "WHERE THERE IS A WILL THERE'S A WAY", 5.00, 8.00);"
I compiled with Visual-Studio and there are many warnings saying "Shortening of "double" in "GLfloat""
At least it runs and shows a grafic screen. See no reason why it should not work in principle.
merano99 6-May-21 1:27am View
As Richard wrote, this are at least 4 different things.

Programming a PIC microcontroller (16/32 Bit) in C is common.
But it is very different from a C program that you can use for a System with operating system. One needs knowledge of the architecture and accesses hardware directly.

Developing the hardware yourself requires electronic knowledge. One creates circuit diagrams and layout, orders the circuit board or do that yourself.

Then you have to assemble the components. Good soldering skills are required for this
and measuring devices as well as knowledge of components and how to find defects.

If you want to connect the finished circuit to the PC, that stays nowadays only the USB interface.

If you don't want to write a driver yourself, it makes sense to make it HID-compatible. Just set the clock in the PIC for USB correctly is quite a task.

Accessing the USB interface on the PC side works with many Programming languages. If you wanted to stay close to the hardware there too ISO C ++ certainly not a bad choice.

I have already realized these things in exactly the same way many times.

Whereby I usually order the SMD board, because you can hardly do it yourself with PICs that have many connections and I also want to avoid working with acid.

To start with, I would recommend buying a ready-made PIC-based demo board with a USB interface.

Then you can deal with the programming and gain experience with the hardware.

If you try everything at the same time, with some certainty nothing will come of it in the end.
Alternatively, you could form a team and split the work.

merano99 6-May-21 0:50am View
You still did not get this right: "for(int n=1; .."
If you start at 1 or 0 you should count up, not down.
merano99 5-May-21 18:16pm View
Your for loop "for (int i=1; i<=n; i--)" is wrong.
Init i with n and compare with 0.
Alternative increment i if yo plan to count other direction.
merano99 5-May-21 18:10pm View
Instead of writing

cout << "Give 1st num: "; cin >> x;
cout << "Give 2nd num: "; cin >> y;

think about writing a method arith::getinput()
merano99 5-May-21 18:07pm View
Look at my answer to your question before:
merano99 4-May-21 17:36pm View
I seems a good hint to solve the problem. The questioner asked what logic is behind the problem and the answer seems appropriate.

merano99 3-May-21 19:05pm View
Does not compile with Visual-Studio

1. xxx.cpp(87): error C2065: "wtime": not declared
2. xxx.cpp(247): warning C4477: "printf": ... Typ "int **" (several warnings)

Are you really shure you want a loop with id?
merano99 28-Feb-21 17:55pm View
"the task was to modify our code so the user can input as many numbers as they can"

Not shure, if scanf("%d", &digit) can realy do this. What happens if you type more than a long can handle?

There are some more errors in the code. e.g. count[digit > 0] does strange things.

I tried "2223334445566677888999222222222441345436257676776573" in VS and the result was -1. The code does not work for digits that are to much.
Better use a loop, read chars and count them.
merano99 23-Feb-21 18:42pm View
On 32 Bit Operatin Systems you get a limit at 4GB (2^32). And you probably can allocate more Memory than you have. The OS will swap memory.
merano99 23-Feb-21 18:34pm View
Dont know if it possible in C#. In C or C++ you could check the arguments and if they dont fit exit the process without opening a window at all.
merano99 19-Feb-21 19:49pm View
Every x86 Prozessor starts in Real-Mode. The use of BIOS-Interrups works and you dont need to switch. Why is ist nessarary to switch?
After switching to Protected Mode you can emulate the Real Mode by switching to Virtual 8086 Mode to access BIOS-Interrups. From Protected Mode you have to Reset the CPU to come back to Real-Mode.

Perhaps this is usefull:
merano99 12-Feb-21 19:22pm View
Perhaps this will help to begin
Accessing Pixels with CreateDIBSection
merano99 19-Jan-21 11:55am View
The linked tutorial is really bad.

"conio.h is a C header file used mostly by MS-DOS compilers to provide console input/output.[1] It is not part of the C standard library or ISO C, nor is it defined by POSIX."
Better never use it - neither for C nor for C ++

Why declare Id and Age as int?
Is it usefull to reach neagtiv?

Why declare name as "char Name[25]"?
Would expect string here.
merano99 14-Jun-20 9:54am View
This is what i found in Microsoft Hardware-Dev-Center:

Customize the Windows performance power slider

There is no way ... from the UI, although it is possible from the cmd line (via powercfg).

Slider availability
The Windows power slider is available for AMD and Intel platforms running Windows 10, build
1709 and newer builds of Windows. It is not available on devices with ARM64 processors.
The slider will appear on a device only when the Balanced power plan, or any plan that is
derived from Balanced, is selected. There is not an option for either users or OEMs to remove
the slider UX.
merano99 16-Jan-20 18:27pm View
Isn't the delete to the free missing?
merano99 2-Jul-19 15:48pm View
The playgame method can be improved too:
void playgame() {
  std::string input;

  while (true) {
	puts("Go player one");
	getline(std::cin, input);
	if (input != "") {
		int index = std::stoi(input) - 1;
		if ((index >= 0) && (index <= 8)) {
			int row = index / 3;
			int col = index % 3;
			char grid_position = map[row][col];
merano99 10-Dec-14 17:15pm View
Does it help to set HBRUSH to 0, not RGB ?