klimi
klimi
...
It's showing an error now
klimi
std::vector<char> has chars inside, not classes
klimi
for(char it:vect)
...
Oh okay
...
Now I feel dumb
klimi
Now I feel dumb
don't be, I am not sure why it isn't getting char from the context myself
Chat Boss
Anikalp Jaiswal sent a code, it has been re-uploaded as a file
...
Actually take a look at this I want result as a 2 b 3 c 3 but instead of this it's resulting into something absurd
klimi
klimi
You created vect as std::vector<int> so... it's not char but it's int; that's why it printed the numbers the first time
klimi
you will have to print the pairs if you want that (you need char and int for the character and the int)
...
Yeah, so do you have any idea to how copy values of a map to a vector in such situation?
...
Oh okay, yeah, actually this is just a part of a problem I have to solve it further.
...
Thanks for helping me out
...
Oh okay, I got your point
Anonymous
Not in a declaration (in this case parameter declaration).
Node *&r means r is a reference to a pointer to Node.
Btw this code is invalid in C. C does not have the concept of a reference.
Anshul
i am trying to add #ifdef inside a function parameter list. but i am getting error.
Is it allowed to do something like this
A fun( int a, double b, #ifdef newPlatform vector<someStructType> c #endif) { <fun defn> }
Anshul
ok so is there any way to do it?
I don't want to create seperate functions for different platforms.
Anonymous
Anshul
ok
Chat Boss
010001010111001001100100011001010110111000001010 sent a code, it has been re-uploaded as a file
Arch
Arch
i have created a snake game program, runned the compiler with no issues but i cannot see the game output, just black window
Arch
Arch
do your computers output the program?
Anonymous
/start@MissRose_bot
Arch
Chat Boss
Ulyana Andreieva sent a code, it has been re-uploaded as a file
Uliana
Who knows how to do that, with pointers, but without fstreams?
B
Is there any CTF like exercises for C/C++?
Anonymous
PS C:\.dev\project\trycmake> cmake .\CMakeCache.txt
CMake Error at CMakeLists.txt:4 (project):
Running
'nmake' '-?'
failed with:
The system cannot find the file specified
CMake Error: CMAKE_C_COMPILER not set, after EnableLanguage
CMake Error: CMAKE_CXX_COMPILER not set, after EnableLanguage
-- Configuring incomplete, errors occurred!
How to set CMAKE_C_COMPILER and CMAKE_CXX_COMPILER?
Anonymous
ynwqmv
how to include boost library in cmake?
Anonymous
how to include boost library in cmake?
Use find_package command. Cmake comes prebuilt with modules that enables searching for commonly used packages like boost, opencv and all. Just search for it online.
Anupam2.7
I am getting a wrong answer error on a chdechef's problem, later I noticed that it is behaving different in printing a expression directly and printing it by putting it in a variable.
i.e. int ans=inc-2*(0.2*inc)-0.3*inc; cout<<n is acting different than cout<<inc-2*(0.2*inc)-0.3*inc;
Why is it happening?
Anupam2.7
already tried. same wrong answer error.
This is the question: https://www.codechef.com/problems/SUGARCANE?tab=statement
This is the code: https://pastebin.com/HnLZHBH3
Suka
Anupam2.7
what do you mean?
Anupam2.7
float?
Suka
Anupam2.7
Anupam2.7
leave it, got it.
thanks
itsmanjeet
can i remove values from vector while iterating to it like
for (auto i = vec.begin; i != vec.end; i++)
if (!i->marked) {
vec.erase(i);
}
}
mj12
itsmanjeet
On
Please I need a C++ beginner project work questions
Ziky
klimi
neon 🇮🇳
Any C++ Projects Crowd Source project where I can contribute in GitHub?
Modern College
Hey guys I'm working on a code and i need a bit of help
in this there's a switch statement is is being assessed to call various function what i want to do is after the function is used i want to to return to switch in main function and run it until i choose to option to exit
can anyone help?
Ziky
Modern College
in which loop and how theres where im getting problem
Ziky
Could you put your code into gist / pastebin and post link here?
Ziky
I guess you need something like
while(1) {
switch(getch()){
case 'a': do_a(); break;
case 'b': do_b(); break;
case 'x': return 0;
}
}
Ziky
Btw I am on tablet and ghis was the simplest thing what came to my mind I am not sure if getch() even exists. Consider it as example of logic, not as working example
TheDevOps
Anonymous
I
Why are you reviving old posts?
AlanCcE
Ahmed
Is C better than C++ in embedded systems generally? Also does anyone still use assembly language or is it that they all now depend on the compilers concerning embedded systems design and peojects
布丁
布丁
I think most of the time what language to use depends on the toolchain provided by the OEM
布丁
Some uses a tailored c/c++ compiler with a broken std but u have no choice
Ziky
Rosemary
Hello
Rosemary
New to C, any mentor ? 🙏
Ziky
Ludovic 'Archivist'
🙃
How do you read a file passed by main from a function?
example :
void function (FILE *f)
{
}
🙃
int main()
{
funtion (stdin);
}