Ибраги́м
This should be named LOL 3.4
Anonymous
Can anyone send me some links for C output problem...
olli
How do I extract the integers from each line?
one solution would be to read each line using fscanf. e.g. char c; int x, y, x; for (each line) { fscanf(file, " %c %d %d %d", &c, &x, &y, &z); }
Avezy
feels bad xD
Avezy
olli is always a bit qucker / more exact
Anonymous
Haha
Avezy
https://www.tutorialspoint.com/compile_c_online.php
olli
So it will break at the space?
the format string is quite similar to the one in (f)printf. "%c %d %d %d" means, read any number of whitespaces followed by a character, then read any number of whitespaces followed by a number and so on. So in the end you read a char and three integers (seperated by whitespaces). the following will print a 123 456 789. char c; int x, y, z; sscanf("\na 123 456\n789", " %c %d %d %d", &c, &x, &y, &z); printf("%c %d %d %d\n", c, x, y, z);
Avezy
You can try what it does helps me atleast
Anonymous
found an interesting article
Anonymous
did you removed the tags bot ?
Anonymous
So guys I've a problem. I am taking input Q lines. Each line has an arbitrary set of numbers separated by spaces. Ex Input: Q = 4 23 43 54 2 1 12 32 43 5 4 2 324 42 Then I've to process those numbers. So what I am doing is, I am taking input each line as a string and then extracting the nos as strings and then using atoi function to convert them to int. Surely there is a better way to do this?
Anonymous
while(Q>0){ string s; getline(cin,s); s +=" "; for(char c:s){ if (c==' '){ x=atoi(temp.c_str()); temp = ""; //process x continue; } temp +=c; } Q--; } ^^looks bad :c
BinaryByter
there isn't really
BinaryByter
if you want to make it look better, split the tasks into very small functions
Anonymous
for each exist on cpp?
BinaryByter
it does on stl compliant containers
BinaryByter
for (auto i : my_vector)
BinaryByter
wait C++ fors have continue?
BinaryByter
NICEEE
Anonymous
Yeah y
BinaryByter
that makes like... everything easier
Avezy
it does on stl compliant containers
and/including on c arrays
BinaryByter
and/including on c arrays
for (auto i : mycarray) works?
BinaryByter
bae
BinaryByter
💜
Avezy
yes it works
BinaryByter
💜YAAYYY
schoffal.com
You can ask as long as the question/problem isn't too dumb and can be solved via a simple google search
@DeadVampire @ollirz I see.. Thank you.. I was studied in 2002 for the basic C.. After that, I never touch this program because I'm working in Networking Industries. Now, I have to study it again for my degree. Currently in subject "Data Structure". This subject looks really hard for me to understand to some terms inside it (structure/Pointer/link list etc).
Box of
So I've got an interesting issue. I have ftrace.h that when I try to compile I get 2 errors: error: implicit declaration of function ‘strncmp’ [-Werror=implicit-function-declaration] (!strncmp(sym, "__x64_", 6) && !strcmp(sym + 9, name + 3)) || error: implicit declaration of function ‘strncmp’ [-Werror=implicit-function-declaration] (!strncmp(sym, "__x64_", 6) && !strcmp(sym + 9, name + 3)) || here's problematic part of code: static inline bool arch_syscall_match_sym_name(const char *sym, const char *name) { /* * Compare the symbol name with the system call name. Skip the * "__x64_sys", "__ia32_sys" or simple "sys" prefix. */ return !strcmp(sym + 3, name + 3) || (!strncmp(sym, "__x64_", 6) && !strcmp(sym + 9, name + 3)) || (!strncmp(sym, "__ia32_", 7) && !strcmp(sym + 10, name + 3)); }
Box of
any idea how to fix it?
Dima
Dima
Anyways, good luck
BinaryByter
schoffal.com
Anonymous
Please send basic notes for c language
Anonymous
Please send basic notes for c language
https://books.goalkicker.com/
Anonymous
Anonymous
Anonymous
don't shitpost here , for shitposting use the Offtopic group
Anonymous
#offtopic
Anonymous
Ok sorry for posting
Anonymous
^ here is the magic link to transer you to the offtpoic group where shitposting is encouraged
Javier
I have to implement a function which reads this kind of input: {a, b, cde} The fuction should just read the words and insert them into a set, without the "," " " or "{}", but I'm stuck. I've try using getline with the "," delimiter but I think it's not working
BinaryByter
get the entire line and then parse it
BinaryByter
https://github.com/Wittmaxi/webcpp/blob/master/src/env_variables.cpp
BinaryByter
look at how I made the GET and POST parsers
BinaryByter
they are pretty similar to your question
Javier
get the entire line and then parse it
And how should I parse it? Read the line til "," or "}" and then insert?
BinaryByter
no, read it completely and then parse it
BinaryByter
from { to , then from , to , and then from , to }
Javier
from { to , then from , to , and then from , to }
And how can I use find with a string with the signs I wanna look for? I mean, I've seen it's just a character
Javier
I don't know if I should use string::find() or algorithm::find()
BinaryByter
with the , its unwise since you have two of em
BinaryByter
BinaryByter
take those two functions as reference
Javier
Ok. I'm reading the whole line with string::getline() . Now I should call getuntil "," then remove, and so on?
Anonymous
How to set environment variable for thread stacksize
BinaryByter
what is neko-webframework?
Dima
My web framework and server
Dima
Anonymous
Sandeep
Please send me software where I can program c and c++.
Anonymous
Thanks
Anonymous
Sandeep codeblocks for Windows ..xcode for Mac
Anonymous
@MissRose_bot thanks a lot , I am not a professional programmer though,.
Javier
Can I overload operator= reciving two objects?
Javier
In order to do something like: object = (var1, var2) and it'll call set method