+ 1
I have to add 041 to 034 and obtain result as 075
But it returns 75 in CPP. What to do..
10 ответов
+ 3
Well the point is:
int x=041 is converted to 41 directly.....
You could convert 75 to a String and add 0 afterwards
+ 3
Do you need to take the input as octal values sid?
int int1, int2;
std::cin >> std::oct >> int1 >> int2; // read inputs as octal numbers.
+ 3
as @lpang mentioned, you need to take the input as octal (use octal base):
std::cin >> std::oct >>a;
+ 3
🎸🎸🎸 Web-Learner Alexander Thiem Ipang Mohamed ELomari Thank you for your time guyz.. really appreciated..
Stay Safe..
+ 2
041+034=075
Or
0.41+0.34=0.75 ?
+ 2
int a[3]=new int[0,4,1];
int b[3]=new int[0,7,5];
int res[3]=[a[0]+b[0],a[1]+b[1],[a[2]+b[2]]; 🍻
+ 1
you are welcome
0
Mohamed ELomari i didnt knew there was a function like this exists.Thank you..
and why this code returns 014 instead of 012.
https://code.sololearn.com/ct1vdYOcrSOu/?ref=app