Prince Of Persia
Btw Do you think 10 is a string?
🤨if yes Read all of your books again😂
Prince Of Persia
Nameful
:d just an example
Examples should preferably make sense
Prince Of Persia
/notes
Nameful
/get awesomeness
Anonymous
Is it even a good idea?
We have hundreds of thousands of libraries that do the same: - NumPy - Transflow - Qt - ...
Prince Of Persia
We have hundreds of thousands of libraries that do the same: - NumPy - Transflow - Qt - ...
Yeah Using C/C++ or any native language for creating library is awesome But creating a library with a not native with another not native language isn't good idea
Anonymous
I mean using C# to create Java library
I don't think it is even possible. they don't compile to the native platform binary, neither java nor C#
Andrew
Please scholars How do C++ programming relates to Java and C# programming language
You can think of java as cpp code that at runtime expects you to feed it with code written in java. Based on the input it receives it does certain operations. This is what the vm is
Roxifλsz 🇱🇹
You shouldn't call your variable the same name as a type (char)
Roxifλsz 🇱🇹
And you can omit the ==1 part
Anonymous
#include <unistd.h> #include <stdlib.h> #include <stdio.h> int main(void) { char *line = "this is a line in a statement"; int i = 0, cnt = 0; while(line[i] != 0) { if (line[cnt] == 32) cnt++; i++; } char *ln[i]; char *word = malloc(sizeof(word) * i); int x = 0, y = 0, z = 0; while(*line != 0) { if (line[y] != 32) { word[z] = line[y]; z++; line++; } if (line[y] == 32) { z = 0; ln[x] = word; while(*word != 0) { x++; word++; } line++; } } printf("%s ", ln[0]); } Please could someone tell me why this produce a wrong output
Anonymous
Jit does it
With help of C++?
Prince Of Persia
With help of C++?
Jit is in JRE
Prince Of Persia
But Even without jit You can use any language with another
Prince Of Persia
Like using python with java in Android app
Prince Of Persia
Or javascript with php or java
Prince Of Persia
Different languages with different VM but can use together
Zaur
Hello, I need help me write a code
Zaur
can you help me ?
Zaur
(binary(base 2), octal(base 8) and hexadecimal (base 16) representations of positive integers)
Zaur
C programming
Zaur
Yes
Prince Of Persia
Yes
So That's your problem
Zaur
Did I ask you whose problem ?!
Prince Of Persia
Did I ask you whose problem ?!
I think yes https://t.me/programminginc/379756
Zaur
I didn't ask you a problem, you wouldn't help write then
Prince Of Persia
/rules
Prince Of Persia
The rules for C/C++ Programming are: on
Prince Of Persia
🤨
Zaur
what does this mean? Did I talk about something other than programming?
Anonymous
Python
Er
Guys if u know just help him, if u can't it will be better to not write 😇
Zaur
What do you expect us to say now
I don't expect you to say anything
Janko Ⓥ
Guys if u know just help him, if u can't it will be better to not write 😇
No lol. It's the group rules, he has to at least show what specifically he needs help with, not the entire program
Anonymous
(binary(base 2), octal(base 8) and hexadecimal (base 16) representations of positive integers)
Hi, and what is your problem with this assignment? that stuff explained many times on every page of the internet, did you try a single search? - How to convert unsigned to binary? - How to convert unsigned to Hex and Octal?
Anonymous
Hi, arrays, pointers in this project I don't know what to use and where to start
For converting the representation of the number you need neither array nor pointers.
Zaur
For converting the representation of the number you need neither array nor pointers.
I have to do these in the c program, I also know how to convert like this
Prince Of Persia
Anonymous
I have to do these in the c program, I also know how to convert like this
i don't understand want you mean. please read this and then try to ask your question: https://stackoverflow.com/help/how-to-ask
Zaur
i don't understand want you mean. please read this and then try to ask your question: https://stackoverflow.com/help/how-to-ask
I need to convert the number entered in the C program to binary, octal and hexadecimal.I need to write code for this.
Anonymous
Hi, arrays, pointers in this project I don't know what to use and where to start
And how converting the representation of numbers related to pointers or even arrays in C?
Zaur
Do you have notion about it ?
I want to do functions, I have 1-2 ideas but I don't know where to start
Zaur
Yes
Zaur
He need algorithm
#include <stdio.h> #include <stdlib.h> function(int n){ int number[100]; int binary,octal,hexademical; . . . . . . } int main(){
Pavel
for hex you can use printf formatting arguments
Pavel
for binary you can do it yourself with the help of bitshifting/rotating
Zaur
i will try thank you
Pavel
for binary you can do it yourself with the help of bitshifting/rotating
or even ultra-slow recursion in order to reverse
Pavel
smth like void binaryrepr_leading_zeroes(int x, int bit) { printf("%d", x & 1); if (bit != 1) { // ignore signbit binaryrepr_leading_zeroes(x >> 1, bit - 1); } } void binaryrepr_no_leading_zeroes(int x) { if (x == 0) { return; } printf("%d", x & 1); binaryrepr_no_leading_zeroes(x >> 1); } ... int main() { ... binaryrepr_leading_zeroes(x, 31); printf("\n"); ... }
Pavel
slowness comes not only from recursion, but also from calling printf for every single bit
Pavel
let me check, maybe printf has an ability to output as binary
Pavel
nah
Zaur
Thank you for your time
Pavel
no problem
Pavel
smth like void binaryrepr_leading_zeroes(int x, int bit) { printf("%d", x & 1); if (bit != 1) { // ignore signbit binaryrepr_leading_zeroes(x >> 1, bit - 1); } } void binaryrepr_no_leading_zeroes(int x) { if (x == 0) { return; } printf("%d", x & 1); binaryrepr_no_leading_zeroes(x >> 1); } ... int main() { ... binaryrepr_leading_zeroes(x, 31); printf("\n"); ... }
if you need wow wow such speed much C and bytef***ing you can do smth like char buf[32]; char res[32]; int pos = 0; while (x > 0) { buf[pos++] = '0' + (x & 1); x >>= 1; } res[pos--] = '\0'; int res_pos = 0; for (; pos >= 0; --pos) { res[res_pos++] = buf[pos]; } puts(res);
Pavel
you can vectorize this for even MOAR SPEED but that's kinda useless in most cases
Zaur
I'm trying to write the code now
Zaur
I thought about that too
Pavel
that's SOOO useless
Pavel
just because it's way harder than the simple code I wrote higher
Vlad
you can vectorize this for even MOAR SPEED but that's kinda useless in most cases
>printing bs into console Oh yeah the speed where it belongs