Talula
This is my point. I am using Visual Studio.
It's better to make and OCX or .NET interface than using DLL... it's easier to use and you wouldn't mix managed with unmanaged.
Talula
This is my point. I am using Visual Studio.
https://www.codeproject.com/Articles/32772/Create-and-Use-a-C-ActiveX-component-within-a-NET
\Device\NUL
sizeof() operator return size_t data type, You shouldn't use int to keep data from sizeof() operator
Hsn
cout <<Enter three numbers and display the middle number;
\Device\NUL
That's bad practice, use size_t to keep value from sizeof() operator
Ammar
Read this http://www.catb.org/esr/faqs/smart-questions.html
Hsn
how about you solve your homework. if you really struggle hard. show us your work and the problem you have after doing some research ? instead of wasting everybody's time including your self and talking about me being confident or not. (which i dont think im). i dont know you and i dont get any benifit if i talk rude to you. i've been in your position many times where people was telling me in a rude way that i didnt even ask a proper question and i think its fair for them and im glad that they are rude to me and others :). thats how you protect a platform from homework spammers / or people who dont research :)
\Device\NUL
Ogey, my message got purged too ;-;
ɛ n h ᴀ n c ɛ ґ 🧟‍♂️
Is there a way to l merge two arrays in another array? Like lets say there are arrays “a” and “b” Then you merge them into another array called “c”?
VladV1V
Can anyone help me with fixing code(C lang)? #include <stdio.h> void reverseSentence(); int main() { printf("Enter a sentence: "); reverseSentence(); return 0; } void reverseSentence() { char c; scanf("%c", &c); if (c != '\n') { reverseSentence(); printf("%c", c); } } It is posting words in reverse and it is right. But i need it to post every reversed word from new line also to make it work only when there is only 7+ words
klimi
Ogey, my message got purged too ;-;
Did I delete something informative? If so I sorry
\Device\NUL
I think you experience an UB cause accessing out of bound array or undefined array value
VladV1V
So if you find new word, just print newline
If i try than it is printing every digit from new line ... Not word
\Device\NUL
Yea...
void reverseSentence() { char c; c = getchar(); if (c != '\n') { reverseSentence(); printf("%c\n", c); } } Like this ?
klimi
You are printing every character on new line
klimi
I thought you wanted only words
VladV1V
I thought you wanted only words
yes but i am not sure how to do this.
klimi
yes but i am not sure how to do this.
Well. You want to replace spaces with newlines
VladV1V
Well. You want to replace spaces with newlines
Thanks seems like figured out now. void reverseSentence() { char c; int isspace(); c = getchar(); if (c != '\n') { reverseSentence(); if(isspace(c)) printf("\n"); printf("%c", c); } } Only problem now that if it is printing 2 or more words messed up and prints one char later dlroW olleH dorw
Oksana
Hi, everyone. I try to build library from MinGW on Windows in Visual Studio. I get headers errors, especially with mm_malloc.h. I create new dll project and add in "additional include directories" directory from MinGW with gcc headers. What am I doing wrong?
Shahrukh
Hi everyone can anyone tell me the logic to find the difference between first and last digit
Apk
Using loop only
Convert to string using loop
Shahrukh
Ok
Talula
Using loop only
Other way to do it would be #include <stdio.h> int main() { int a = 524063; printf("%d\r\n",a % 10); int i = 10; while (a > 10) { i = i * 10; a = a / i; } printf("%d\r\n",a); }
Talula
What's this?
Without using the string and using loop.
Apk
Without using the string and using loop.
I got that but what are you doing here?
Talula
No, it gives output of 8 and 5
Apk
Without using the string and using loop.
Okay you are just printing the first and last digits... Got it But I think I=I*10 is wrong
Anonymous
Using loop only
Why do you need a loop?
Shahrukh
Share your code
Apk
It works... try it.
Try with I = 52
Talula
Try with I = 52
Yeah, it doesn't work with less than 3 numbers... I tried it too...
Shahrukh
That's the issue I'm facing too
Shahrukh
Coz logic is not appropriate
Anonymous
Share your code
#include <iostream> #include <cmath> int main() { int num = 8765432; std::cout << (num / static_cast<int>(pow(10, static_cast<size_t>(log10(num))))) - (num%10) << std::endl; return 0; }
Talula
What's this?
You're right... #include <stdio.h> int main() { int a = 23; printf("Last: %d\r\n",a % 10); while (a > 10) a = a / 10; printf("First: %d\r\n",a); }
Talula
Coz logic is not appropriate
The above logic works.
Anonymous
Printf is what
Shahrukh
Anonymous
I don't see scanf
Shahrukh
I don't see scanf
Not taking input from user
Dima
lol
Anonymous
The above logic works.
No it doesn't.
Peace
How can print value of count using local static variable ? void func(void) { static int count; count++; } int main() { func(); func(); func(); func(); func(); cout<< count <<endl; // count is a local variable to func() function, so cannot access. }
Peace
Return the value of count from that function and print it when you need it.
when the program ends i need check how many times this function is called . And want to do this using local static variabl.
Anonymous
when the program ends i need check how many times this function is called . And want to do this using local static variabl.
Return a reference to that local static variable and check it's value when the program ends.
Anonymous
what ?
What?
Peace
Anonymous
Means , return a reference to that local static variable. How ?
int& func(void) { static int count; count++; return count; } int main() { auto& a = func(); func(); func(); func(); func(); cout<< a <<endl; // count is a local variable to func() function, so cannot access. }
Anonymous
int& func(void) { static int count; count++; return count; } int main() { auto& a = func(); func(); func(); func(); func(); cout<< a <<endl; // count is a local variable to func() function, so cannot access. }
This is bad practice but. If you want to know how many times a function was called, use a profiler. If you want it done in your program, then log the value of count from inside the function and then check the log statements to see how many times it was called.
Anonymous
Undefined Behaviour
Nomid Íkorni-Sciurus
Hi guys this is very weird, but: std::string err(""); err.append("Assertion ["); err.append(::w2s(name)); err.append("]#"); err.append(std::to_string(i)); err.append(" failed"); throw std::runtime_error(err); I'm getting an exception while throwing runtime_error. It just says Unhandled exception in 0x00007FFD6143466C (KernelBase.dll) what do you think?
Anonymous
I'm not using any DLL. What information do you need?
Well, just saying that throwing an exception resulted in an unhandled exception is just out of the blue. The code you have shown has no reason to throw an exception unless w2s threw an exception in which case you wouldn't see the exception at your throw statement. I would suggest searching for that error message on Google to see if someone else faced the same issue and when. Maybe one of the reasons might match yours.
Anonymous
already did; seems like somebody in 2019 had the same issue and wrote a feedback in the ms forums, but they got no response.
Well you could try your luck again on MS forums. Honestly questions on Windows usually go unanswered in this forum. With *nix, usually there will be someone around to help
Nomid Íkorni-Sciurus
Well you could try your luck again on MS forums. Honestly questions on Windows usually go unanswered in this forum. With *nix, usually there will be someone around to help
Actually... probably it's me being an idiot I put my try/catch outside the WndProc, and the runtime exception is being risen in the WndProc could that be the problem?
Nomid Íkorni-Sciurus
(the try/catch wraps the message loop)
Nomid Íkorni-Sciurus
yeah that was the problem
Nomid Íkorni-Sciurus
wndproc is in another thread at the time of execution (obviously), my bad