\Device\NUL
First, it will load the address value into eax. The eax value added 4 value.
Load the arithmetic result to original address again.
\Device\NUL
I guess it's some x86 ABI ...
/
𝑪𝒐𝒃𝒓𝒂
How to practice c++
Mohamed
Write a C++ program to add two 4-bit binary numbers (without IF or DO or loops )? 😓😓😓 help me
i can not solve the carry part in summation
/
\Device\NUL
I know
Show your code then
DaviChan
DaviChan
So yeah, just resolve the loop by writing this 4 times
DaviChan
or use goto
Mohamed
DaviChan
I know, i was too lazy 😂
DaviChan
just write it 4 times 😅😅
Mohamed
no
DaviChan
Soory, i can write proper c++ code kater 😂
Mohamed
user will put 2 nums
Mohamed
in binary ... so you will read digits from user ...then calculate them manually using the RAW CODE
DaviChan
Sorry, i dont get that 🤔
DaviChan
The first part, yes 2 binary numbers, likely inputted as ascii characters
smr
Mohamed
I MEAN ...you will make the hole function
DaviChan
a + b;
True just use an uint8 and set the bytes bases on the input and then just add it with the build in + operator 🤷🏻♂️👌
Mohamed
lets say ..... A1,A2,A3 ,A4 the first digits in memory ...B1,B2,B3,B4 the second ...C1 C2 C3 C4 the result ....and the user put 1011 for A and 1101 for B
Mohamed
so if we used the normal sum (+) you will get 2112
DaviChan
yes. I forgot to add the carry in lol
Mohamed
the question here how to use the modulus or the integer division to get the binary result
DaviChan
use %2 on each digit
Mohamed
res should be 10000
DaviChan
for the carry. Uhm lets think
Mohamed
ok very good ... then how to carry one ?
DaviChan
The carry is : result/2
Mohamed
lets say C1 = 0 =result
DaviChan
Yes?
Mohamed
DaviChan
Yes 👌
Mohamed
Yes 👌
the carry should be one ...added to the second bit
DaviChan
0/2 = 0
1/2 = 0
2/2 = 1
3/2 = 1
Mohamed
DaviChan
and the res will be:
0%2 = 0
1%2 = 1
2%2 = 0
3%2 = 1
DaviChan
So that is all you need for each digit
DaviChan
the starting point you get by num1[i]+num2[i]+carry
DaviChan
Where carry is initialized to 0 ofc.
DaviChan
To sum up. For each digit you do:
DaviChan
DaviChan
DaviChan
Ill have time to write a proper short snippet later 😅
DaviChan
ill need to find a way around the loop limitation. I guess recursion and goto is also forbidden?
Ольга
ببب ب
Anonymous
How to return a free-able empty string
1-) return ("");
2-) return (strdup(""));
3-) char *r ="";
return (r);
4-) char *r;
r = malloc(1);
*r =0;
      return (r);
Anonymous
Which options valid answer?
Anonymous
Anonymous
❓
Anonymous
Why?
Anónimo
it looks like homework
ᅠ
Anónimo
read the pinned message
ᅠ
Anónimo
no worries
𝕷𝖔𝖗𝖊𝖓𝖟𝖔
Hi guys, I set a buffer like this:
char *line= malloc(size of(*line)*64);
Then I tried to read a file, in which this was written: a1b2c3d4e5f
while(fgets(line, sizeof(line), fp))
Problem is, fgets will always read 7 bytes and not more. As you can see, I gave the buffer 64 char of space, so this bugs me. Why is this happening? It's like it encounters a \n after the seventh byte read
klimi
𝕷𝖔𝖗𝖊𝖓𝖟𝖔
Well since line is a char *, *line should be a char, therefore I'm allocating memory for 64 chars, or am I wrong?
𝕷𝖔𝖗𝖊𝖓𝖟𝖔
Ok now I understand, yep I really screwed up on that one ahaha, thank you very much for your support! Line was supposed to be declared like char line[64], therefore I wrote the fgets that way and never realized I had to change it. Thank you very much!!
Nomid Íkorni-Sciurus
Hello
I'm using conan (CMakeToolchain, cmake, cmake_find_package_multi) and I'm trying to link SDL2 to my application.
find_package(SDL2 REQUIRED CONFIG)
add_executable(RVR
${DIR_SRC}/rvr.c
)
target_link_libraries(RVR PUBLIC SDL2)
This seems fine but when I try to build it, MSBuild just fails like this:
LINK : fatal error LNK1104: cannot open file 'SDL2.lib'
Any ideas?
Nomid Íkorni-Sciurus
Solved it. I didn't specify
lib, *.lib* -> ./bin
in my conanfile imports
\Device\NUL
Anonymous
\Device\NUL
.....
H
M
Hello guys
I want to Find the minimum number of coins that make a given value
Using (dynamic programming with memoization)
Here is the code 👇🏻 in a bottom-up manner.
Who can help me writing the code in a top-down manner (memoization)🥲?
Nomid Íkorni-Sciurus
Nomid Íkorni-Sciurus
https://docs.conan.io/en/latest/reference/conanfile_txt.html?highlight=dylib