Anurag
Actually this is what I'm intending to do:
I have a string variable and I want to convert the string inside it into a raw string
Anurag
Anonymous
How to convert a string input to raw string in cpp?
C++ supports only raw string literals. Treating special characters as normal in a user inputted string is within your own purview. You can do it manually by escaping each special character with a backslash. I am assuming that you are doing so because this input is being passed somewhere like a shell command line which has its own escape mechanism.
Ибраги́м
https://www.youtube.com/watch?v=VpqwCDSfgz0
后藤
How can i learn cmake for accustoming to compiling with the gcc command?
Anonymous
How can i learn cmake for accustoming to compiling with the gcc command?
You mean you want to CMake to use gcc as a compiler? CMake will determine the compiler to use automatically during the configuration stage (the stage before the build generator). If it didn't choose GCC and you want to force it to choose GCC, you can do it by passing -DCMAKE_C_COMPILER=<path to gcc> -DCMAKE_CXX_COMPILER=<path to gcc> when you use CMake to generate the build file i.e.
cmake -DCMAKE_C_COMPILER=<path to gcc> -DCMAKE_CXX_COMPILER=<path to gcc> -S <source tree> -B <build tree>
后藤
Rehan
Swapping in linked list
Anyone tells?
Rehan
Rehan
Or for single linked list
𝕷𝖔𝖗𝖊𝖓𝖟𝖔
[C language]
Hi, I have a file divided into "sections" like this:
A1B2C3
//Stuff
B4V6N8
//Stuff2
M9N8B5
Let's imagine I want to cancel Stuff2, which may be several lines. Now, in my software I'll make sure the file poiner is set at the beginning of stuff 2.
Now, reading on stack Overflow I understand that the only way to do so seems to be copying everything you need on another file, then scrap the old one and so on.
Problem is: this file is HUGE, and this thing happens very often... so, I think this method is too slow and heavy for my code, is there another way to do so?
Gilded
How to automatically correct full code syntax in codelite c workspace????
Gilded
Pls anyone say asap
Sleeves
Hey guys I’m studying C programming under windows
Sleeves
What is a modern day equivalent of : Finogenov K.G. "Win32. Basics of programming
Khadija
Hi hope you are doing well
I have a question …
Please why we use Void function for sort tables ??
Selection sort , bubble sort ……?
Khadija
You can find a great courses in udemy or udacity even in YouTube …
And try to start with c because it is basic then go to c++ …
Good luck
Khadija
… try to solve problems by C and do some projects like files .. management system …. Etc
Then go to C++
Btw ( C++ is simple then C ) but just when you start learn a language try to finish it ..
Good luck
Unk
How can i change hier malloc with new ?
int d;
cin >> d;
double** matrix;
matrix = (double**) malloc(sizeof(double*)*d);
I do that so but it‘s wrong:
*matrix = new (double*d)
Pavel
For matrices what I saw people usually do is they allocate an array of size M*N and address them using them with something like (x+y*M).
neovstan
Don’t start from C. Please. There’s a lot of the bad habits of C that developers use in their C++ code
🇺🇸
Hello everyone
Can someone help me to write code which will able to demonstrate specific pattern
Unk
𝕷𝖔𝖗𝖊𝖓𝖟𝖔
Hi hope you are doing well
I have a question …
Please why we use Void function for sort tables ??
Selection sort , bubble sort ……?
Let's assume you are sorting a list. You will want to pass the head of the list as a double pointer, that is to say, imagine this is your head:
Struct node *head;
Well, when summoning bubble sort (imagine you are in function main and then summon function bubble) you'll pass bubble(&head).
This means that the node you pass (head) it's a copy, but the address is "real". Therefore, everything you do in bubble will be effective also in main and every other function.
If you passed head, bubble would still modify stuff, but it would actually be a copy of the head.
Well, since you modify the real thing, then you don't need to return anything. The function will do stuff, but you operated directly on the address where this stuff is stored, therefore, when control is returned to main, you'll keep using head, but the list will be sorted different.
If you passed bubble(head), bubble would sort a copy, then control is returned to main and you'll be using the non sorted list.
In this second version, you would need bubble to return a pointer:struct node *blubble(struct node *node);
Therefore in main you'll do this:
Struct node *new=bubble (head), then you'll use new and you'll have the sorted list, head and you'll have the non sorted one.
Anyway, the first way is the best one
E🦈
Can everyone explains me how loops i j k or i j k l works?
Anonymous
𝕷𝖔𝖗𝖊𝖓𝖟𝖔
What do you mean by "cancel stuff2"?
Stuff2 is like 100 lines of text. In my implementation it's a text message, and the user wants to delete it from a web site. For this project I'm using a file as a backup for data persistence, therefore if the mex is deleted from the web site, it should be deleted from the backup file, too
𝕷𝖔𝖗𝖊𝖓𝖟𝖔
Well they basically are what makes C such a powerful language imho. I'm not a senior coder, therefore I'll not deep any further in to this question, as I might tell you wrong stuff, but check on YouTube: you shall find hundreds of videos explaining the difference between (that's what you are looking for in the end) passing arguments from value rather than from address and so on, and they surely know better than me how to make sure you understand this crucial aspect of C
𝕷𝖔𝖗𝖊𝖓𝖟𝖔
Well if you want text deleted from a file, you don't have much of a choice. Since it is a backup copy,you also want to be extra careful. So copying to a new file and writing only the changes you need is the only option.
You shouldn't be using a text file as a backup for this case. A document database like MongoDB would be the best fit for this use case.
Well, if it's the only way, so be it!
Btw, yes, the text file is not good for backup, but it's an Operating Systems project in university, therefore I still don't know how to use this.
But in reality it's interesting, even though the prof doesn't expect us to use anything else than text I'm interested in making project much more robust, so I'll give it a look
ossset
Hey! I do have a newbie question here - can't really get why the string is not getting printed, can i ask someone to point out my mistake? https://pastebin.com/uF7fiDfn
neovstan
Don’t start a programming languages’ trip from C, guys
Гулящий
Well, that was a wise decision.
Khadija
Let's assume you are sorting a list. You will want to pass the head of the list as a double pointer, that is to say, imagine this is your head:
Struct node *head;
Well, when summoning bubble sort (imagine you are in function main and then summon function bubble) you'll pass bubble(&head).
This means that the node you pass (head) it's a copy, but the address is "real". Therefore, everything you do in bubble will be effective also in main and every other function.
If you passed head, bubble would still modify stuff, but it would actually be a copy of the head.
Well, since you modify the real thing, then you don't need to return anything. The function will do stuff, but you operated directly on the address where this stuff is stored, therefore, when control is returned to main, you'll keep using head, but the list will be sorted different.
If you passed bubble(head), bubble would sort a copy, then control is returned to main and you'll be using the non sorted list.
In this second version, you would need bubble to return a pointer:struct node *blubble(struct node *node);
Therefore in main you'll do this:
Struct node *new=bubble (head), then you'll use new and you'll have the sorted list, head and you'll have the non sorted one.
Anyway, the first way is the best one
Thank youuuuuuu
Gilded
All questions no answering people online today 😞
Gilded
Let's assume you are sorting a list. You will want to pass the head of the list as a double pointer, that is to say, imagine this is your head:
Struct node *head;
Well, when summoning bubble sort (imagine you are in function main and then summon function bubble) you'll pass bubble(&head).
This means that the node you pass (head) it's a copy, but the address is "real". Therefore, everything you do in bubble will be effective also in main and every other function.
If you passed head, bubble would still modify stuff, but it would actually be a copy of the head.
Well, since you modify the real thing, then you don't need to return anything. The function will do stuff, but you operated directly on the address where this stuff is stored, therefore, when control is returned to main, you'll keep using head, but the list will be sorted different.
If you passed bubble(head), bubble would sort a copy, then control is returned to main and you'll be using the non sorted list.
In this second version, you would need bubble to return a pointer:struct node *blubble(struct node *node);
Therefore in main you'll do this:
Struct node *new=bubble (head), then you'll use new and you'll have the sorted list, head and you'll have the non sorted one.
Anyway, the first way is the best one
What that star mark signifies *
Gilded
I didn't study im unable to connect concentrate
● Igor
I'm trying to format this number 2006.008 to show as _______+2006.01
so i did this:
cout << setfill('_') << setw(15) << fixed << setprecision(2) << showpos << 2006.008 << endl;
but the sign is always before the _, even if i change the order of the parameters...
+_______2006.01
● Igor
nevermind, i just needed to use << right <<
hello
hi, can you use a file pointer name that is delared in one file in another file , using makefile or anything like that?
浩
Hello, How to implement this behavior in compile time: check whether a class owns a member, if does, use it, otherwise check another member, if does, use it, otherwise raise compile error? I am currently trying this, but it does not work:
static constexpr Name Contract_1 = []() constexpr->Name {
if constexpr (requires() { InternalName<Name>::Contract_1->Name; }) {
return InternalName<Name>::Contract_1;
} else if constexpr (requires() { InternalName<Name>::Default_1->Name; }) {
return InternalName<Name>::Default_1;
} else {
static_assert(false);
}
}
();
𝑪𝒐𝒃𝒓𝒂
from where can I get practice questions ?
mito
Joo
I want to start doing projects using c++. Can I get any recommendations??
klimi
UrCodeBuddy️ 💻
Joo
Joo
klimi
Ooh okay
but if you have question, feel free to ask
Joo
Actually, I wanted a site recommendation I could find some projects to do
Joo
Oooh okay
Гулящий
Oooh okay
You want a real big project or would you like to focus on small exercises for now?
Joo
Small exercises bro
Anonymous
浩
Pietro
Hello, is there a way to format the console output? (Example: making the text of a single line bold, or change the font size). And if not, how should I format it? Sorry for bad english, thanks to all who will reply.
klimi
hello
Hi i have 2 files connected via header and because of that the second file compiles before my main file and all the variables in it which i have definitions for them in my main file, what can i do?
I compiles and says the variables are undeclared
Anonymous
Hey all will u please help me in c++ I have project of calculator
Is like
Suppose I am doing the addition of the two number a+b=24 and the suppose the answer is 24 then after that from the user to ask that whether you want to continue with answer and add another digit in answer and then again add and if not then say no and continue to the next part
Anonymous
How it would be
Anonymous
I hve written half of the code
Yui
https://godbolt.org/z/36bvWcnEd why does it still expect a type🤨
Yui
oh i change the order of declaration it fixed..
Yui
another question: why must I specify the namespace of database template parameter, like this https://godbolt.org/z/P67h81n6W
Yui
...my bad, just glanced that the local variable name is the same as type name
labyrinth
github trending page seem to sucks
labyrinth
lack of real projects
mack
#include <iostream>
using namespace std;
class MyClass {
public:
void DisplayMessage(const char *Text, unsigned int Type)
{
cout << "Message:Text=" << Text << endl;
cout << "Text=" << Type << endl;
}
void DisplayMessage(const char *Text, int Type)
{
cout << "Message:Text=" << Text << endl;
cout << "Text=" << Type + 10 << endl;
}
};
int main() {
unsigned char value = 0;
MyClass my;
my.DisplayMessage("Hello", value);
}
why run second DisplayMessage?
mack
The answer is :
Message:Text=Hello
Text=10