Leonardo
the fscanf what value returns?
Leonardo
the numbers of elements read in a file?
Leonardo
for example this code https://dpaste.org/8WBAp in the while fscanf(...)>0 means: read the file unless you reach the EOF?
Leonardo
what does it means fscanf(...)>0?
Leonardo
man fscanf
sorry i dont understand this😔
\Device\NUL
sorry i dont understand this😔
https://man7.org/linux/man-pages/man3/fscanf.3p.html
\Device\NUL
Syed
Can anyone send me any pdf of C++ from basics? Where problems with explanations are given...
...
can anyone tell me how to become master in c programming language
...
to write many code
where can I get them for free
Anonymous
...
get what? code?)
from where i can practice them im still a beginner
Leonardo
why gets is dangerous?
Anonymous
from where i can practice them im still a beginner
u can do it in many ways for example different websites, where u can practice tasks from books about C or algorithms or just create smth by yourself, solve ur personal problem from ur life
\Device\NUL
why gets is dangerous?
Buffer overflow
Anonymous
why gets is dangerous?
cuz gets read all from STDIN and just paste it into ur buffer, without length checking and it can be overflowed
Mr
why gets is dangerous?
Use fgets instead of gets
\Device\NUL
Me use scanf with max field width
\Device\NUL
scanf to input string without limit is same with gets
Anonymous
Hi
Doreece
Hi .Would you please help me solve this out ? I should write a code which gets from me (n) as the number of numbers I should give to the code after that .then i should calculate the sum of every 2 numbers to find the couple with sum which I gave as the last number before . My code calculates only the first number with others and doesn’t check the 2nd with others and so on.
Rajeev
multimap<int,int> m; m.insert(make_pair(10,20)); //m[10] = 20; this isn't working why? Today while coding in C++ i came up with an unknown error. I used this method on maps but it it's working on multimap. Anyone know why? no match for 'operator[ ]' (operand types are 'std::multimap<int,int>' and 'int') m[cs] = i;
alessandro
send slice of code
alessandro
wait, you want assign 20 in box, but you just have created 1 box
alessandro
std::map<int, int> m; m.insert(std::make_pair(10, 20)); m[0] = 1;
Rajeev
std::map<int, int> m; m.insert(std::make_pair(10, 20)); m[0] = 1;
Yes we just do normally in pairs and vector. my_map[key] = value;
Rajeev
But this isn't working in multiple map .
alessandro
alessandro
it hasn't a key does you could access your data
Rajeev
Oh got you. Because of multiple keys
Rajeev
Just learnt something new. Thanks
alessandro
wait
alessandro
you could do something but it's not much clever
alessandro
create a iterator and then use function advance(it, position)
alessandro
std::cout « m->first « m->second
Rajeev
Another problem of multimaps multimap<int,int> m; auto start = m.begin(); cout<<*(start).first; // doesn't work cout<<start->first; // why?
olli
Another problem of multimaps multimap<int,int> m; auto start = m.begin(); cout<<*(start).first; // doesn't work cout<<start->first; // why?
have you tried to compile it? the compiler tells you, std::multimap<K,V>::iterator has no member first. (*start).first works because you need to dereference it first so you get std::multimap<K,V>::value_type which is std::pair<const K, V> and has a first member
Deepak
Hello everyone, I need a code on scientific visualization can anyone help me regarding this
...
some of them write c program like this: #include<stdio.h> #include<conio.h> void main() {clrscr(); getch(); } and some people write like this: #include<stdio.h> int main () { return 0; } which is better to write
olli
some of them write c program like this: #include<stdio.h> #include<conio.h> void main() {clrscr(); getch(); } and some people write like this: #include<stdio.h> int main () { return 0; } which is better to write
5.1.2.2.1 [Program startup]1 The function called at program startup is named main. The implementation declares no prototype for this function. It shall be defined with a return type of int and with no parameters: int main(void) { /* ... */ } or with two parameters (referred to here as argc and argv, though any names may be used, as they are local to the function in which they are declared): int main(int argc, char *argv[]) { /* ... */ } or equivalent;[10] or in some other implementation-defined manner. Footnote 10) Thus, int can be replaced by a typedef name defined as int, or the type of argv can be written as char ** argv, and so on. It's best to use int main, as void main is not guaranteed to work.
Zahra
Hi, does anyone know how to write a code that calculates the derivative of polynomial functions?
Anonymous
mingw32-make: *** [launch ] Error -1073741819 what is this problem ?? how i can fix it ??
Anonymous
Another problem of multimaps multimap<int,int> m; auto start = m.begin(); cout<<*(start).first; // doesn't work cout<<start->first; // why?
This shouldn't work on a map either. Read olli's reply above to understand why. Further, read about operator precedence.
Anonymous
Hii everyone 😃 I actually learned the basics of c++, Can someone plese give me an advice on what to do next ? 🙏 Like how to apply it to become advanced Thanks ! 😊
Anonymous
I'm trying to use default arguments for some parameters without rearranging the parameters. This is what I want to achieve but its not working. void func( int a =1, int b = 2, int c = 3) { } Int main() { func(5 , , 8); } I only want to use the default argument in the middle or only the last default argument or both 2nd and last default argument. So I want to pass value only to the first parameter.
Anonymous
I don't want to rearrange the parameters because I may sometimes use the first as default and pass the second and third
Anonymous
Make hobby projects and apply for a job
I mean do you have a project in mind ? Or if you can suggest a youtube channel , or website that can help ?
Pavel
I mean do you have a project in mind ? Or if you can suggest a youtube channel , or website that can help ?
There are infinite possibilities of what you can do. On top of my mind you can help with my project if you want, I'm making a super simple videogame and would like a help of someone who has a desire to learn about rendering :) But seriously, I can't choose for you, for a hobby project do something you feel fun, then you will be more motivated to learn more.
Rakesh
Evaluate the following expressions: 1) 22 +3<6 && !5 || 22 = =7 && 22-2> +5 How to solve further... 0&&!5||0
Michel
Is there any way of making an enumeration to hold a value? I want to have, for instance: enum Token{ PLUS, MINUS, NUMBER } In such a way that I can pass a value if the Token is NUMBER.
Dm
Is there any way of making an enumeration to hold a value? I want to have, for instance: enum Token{ PLUS, MINUS, NUMBER } In such a way that I can pass a value if the Token is NUMBER.
You can use enun class which can help you to create a variable with enum class type. In case if you want to assign value to enun field that's not possible. First of all, enum will work similar to defines and as you know you couldn't change defines in run time (you could ever see them directly). In your case I can suggest you to create struct with 2 variables: enum class Token { Plus, Minus }; class calculator { Token sign; int number; };
Anonymous
can
Leonardo
guys ive got a question...i have to take some data from a csv file...i have to use the fscanf but idk how to do that...the first line of the file are the names of the columns and the others 1599 are the data that i have to read...with the fscanf i want to store the data from the file in an array of float and when i go to read this array i see some weird numbers , also i idk how to discard the first line cause fscanf read unless it reaches a space
Anonymous
klimi
I think you will have to send your code, skipping first line just means you just read the line and then start to parse (if you want to completely ignore it)
ricks
Hi I've been playing around with c++ ,What framework are you guys using with c++ nowadays?
ricks
as for me, i don't use any :D
So how do people implement their c++ knowledge in real job application?
Ludovic 'Archivist'
So how do people implement their c++ knowledge in real job application?
My advice if you want a good starting point for a C++ portfolio would be to group your utility functions and types in one or more libraries on github. Maybe make some tooling (for example I have configurable scripts I reuse for doing code coverage, testing...)
Ludovic 'Archivist'
We all have those little comfort function we make because the std library lacks them
Ludovic 'Archivist'
like, I have this repeat function that I use all the time for writing tests or just code that repeats: template <typename F> void repeat(size_t n, F f) { while (n--) f(); } And in a library it goes just to avoid the mental hurdle of writing it again
Pavel
Hi I've been playing around with c++ ,What framework are you guys using with c++ nowadays?
What kind of framework you have in mind? There's STL for basic stuff, there are things for UI like Qt, there are things for games (game engines) like UE5, and other things for other needs
Trí
#include<stdio.h> int main(){ float a[ ] = { 13.24, 1.5, 1.5, 5.4, 3.5 } ; float *j ; j = a ; j = j + 4 ; printf ( "\n%d %d %d", j, *j, a[4] ) ; return 1; }