Sololearn: Learn to Code
New course! Every coder should learn Generative AI!
Try a free lesson
+ 17
Hi ChillPill, I think its because number of bits for <a> and <b> are limited. Code Playground gave warning when we run this code, explaining what happened. DEC BIN 36 0010 0100 4 0 0100 ( only 5 bits allowed ) 6 0000 0110 2 10 ( only 2 bits allowed )
24th Jan 2021, 7:27 AM
Ipang
+ 13
No, it's writing 4 2 You are assigning 36 (100100) to a 5 bit field, so it takes only the first 5 bits: a=00100=4 And you are assigning 6(110) to a 2 bit field: b=10=2
24th Jan 2021, 7:28 AM
Angelo
Angelo - avatar
+ 5
1. 36 (<unsigned char:8>) is converted into <unsigned char:5>. 36 mod (2 ^ 5) = 36 mod 32 = 4. Unary plus converts it into <int>. Output1 = "4"; 2. 6 (<unsigned char:8>) is converted into <unsigned char:2>. 6 mod (2 ^ 2) = 6 mod 4 = 2. Unary plus also converts it into <int>. Output2 = "2"; FinalOutput = Output1 + Output2 = "42" (Late with answer because of infinite posting answer glitch)
24th Jan 2021, 7:44 AM
#0009e7 [get]
#0009e7 [get] - avatar
+ 5
Please don't spam here
25th Jan 2021, 6:55 PM
Sonic
Sonic - avatar
+ 4
Abdalrhman Wa post a separate question for that.
24th Jan 2021, 9:09 PM
Sonic
Sonic - avatar
+ 3
When you remove << string(42,'\n') from this code, you will get two warnigs with explanation, what happend. I could imagine a control for digital display similar to 7-segment display.
24th Jan 2021, 9:01 AM
JaScript
JaScript - avatar
+ 3
JaScript, string(42, '\n') just creates the string with 42 newlines. There are still warnings, but you need to scroll down (on SoloLearn Playground) to see them.
24th Jan 2021, 3:08 PM
#0009e7 [get]
#0009e7 [get] - avatar
+ 2
get thanks for the explanation.
24th Jan 2021, 3:45 PM
JaScript
JaScript - avatar
+ 2
Abdalrhman Wa, hmm... We do not solve exam assignments for others, we can only fix errors and give clues on how to make it.
25th Jan 2021, 5:34 AM
#0009e7 [get]
#0009e7 [get] - avatar
+ 2
👍
25th Jan 2021, 9:33 PM
شهاب الضباب
شهاب الضباب - avatar
0
Abdalrhman Wa, even if I want to help you, I cannot: learning C# is currently on my plans only 😂. And it is not necessary to have a computer or laptop to code (but most of people prefer to program at PC/laptop — better tools, larger screen, etc.). You can use this app — SoloLearn; C# online compiler — https://play.google.com/store/apps/details?id=com.krazeapps.csharpprogrammingcompiler, https://apps.apple.com/id1451066693; for Android — offline C# shell: https://play.google.com/store/apps/details?id=com.radinc.csharpshell; for iOS — (hope that good) program for C# and F#: https://apps.apple.com/id1095213378 (paid); https://apps.apple.com/id1452106609. You can also watch others' codes here (Code Payground -> "Language: C#" filter). And, like @Sonic said, post a new question and do not try to get answer on a solved question — thus, there will be greater chance for your question to be solved (if I would have unfollowed to this question, there would be 60% chance of you being unnoticed).
25th Jan 2021, 12:23 PM
#0009e7 [get]
#0009e7 [get] - avatar
0
Abdalrhman Wa, I did not learn C# yet, so how am I supposed to write code???
25th Jan 2021, 6:10 PM
#0009e7 [get]
#0009e7 [get] - avatar
0
Now two code-beggers... I get out of here...
25th Jan 2021, 6:11 PM
#0009e7 [get]
#0009e7 [get] - avatar
2nd Feb 2021, 6:34 PM
SERG Starkov
SERG Starkov - avatar
- 3
I have exam tomorrow at 8 PM, in Composition & aggregation & static
24th Jan 2021, 9:27 PM
Abdalrhman Wa
Abdalrhman Wa - avatar
- 3
Write a function namely multiply of type int that takes two arguments of type int then call the function in main function. The function will return the multiplication of the two arguments.
25th Jan 2021, 5:45 PM
Suhail
Suhail - avatar
24th Jan 2021, 9:28 PM
Abdalrhman Wa
Abdalrhman Wa - avatar
- 4
get please just simple code. I don't have pc or laptop
25th Jan 2021, 11:52 AM
Abdalrhman Wa
Abdalrhman Wa - avatar
- 4
get dude you don't understand me, I didn't study any chapter c# because I can't learn online and my doctors don't explain enough, so I can't solve the quiz after 2 hours
25th Jan 2021, 3:40 PM
Abdalrhman Wa
Abdalrhman Wa - avatar
25th Jan 2021, 7:48 PM
Geoffrey Muli
Geoffrey Muli - avatar