mack
I mean is the statement —my.DisplayMessage("Hello", value); will call 【 void DisplayMessage(const char *Text, int Type)】 function rather than second function that 【 void DisplayMessage(const char *Text, unsigned int Type)】 function.
Jonathan
you may want know Implicit rule
mack
yes, but i can't find the rule that contains from unsigned char to int or unsigned int
mack
Jonathan
Jonathan
https://en.cppreference.com/w/cpp/language/implicit_conversion
Jonathan
unsigned char or unsigned short can be converted to int if it can hold its entire value range, and unsigned int otherwise
mack
ok,i see, thank you!
mack
Jonathan
.
👍Ok
Mr
Or for single linked list
You have to copy first node which will swap into a node(similar to swapping variables) and after that replace second node with first node and replace second node with the temporary node. And replace address part of first node(which was second node) with second node(which was first node). Just Like this, Temporary_Node=First_Node First_Node=Second_Node Second_Node=Temporary_Node Free Temporary_Node First_Node -> address = Second_Node
பாலமுருகன்
#res
● Igor
is there a runtime extra cost of using C++? why some people don't like using it and prefer C?
后藤
Which ide can i compile multi cpp/cuda file without lots of configuration on wsl-ubuntu? too lazy to check the cmake lists.
𝕷𝖔𝖗𝖊𝖓𝖟𝖔
[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?
For everyone interested, here is a solution to the problem: if you are in a client server application and a client requests to cancel his message from the system, you mark the message on the backup as "not valid" (just come up with an escape sequence meaning not valid, like A1B2C3), then wait until you have a certain number of delete requests, then delete every message on the file marked as not valid. Therefore yes, the project is a little more complex, but in the end you copy paste the file just once, instead of many times
Pietro
sure, you just need a compatible console and then you need to know how to control your console
Thank you, I'm new to this language. Which console do you recommend for this kind of job?
klimi
Thank you, I'm new to this language. Which console do you recommend for this kind of job?
https://en.wikipedia.org/wiki/ANSI_escape_code#Unix-like_systems
Apna
Which is best btech CSE or CSE with specialization?
klimi
Which is best btech CSE or CSE with specialization?
What's that and how is it related?
Eyal
https://github.com/microsoft/cpprestsdk
Aquatica
https://github.com/microsoft/cpprestsdk
cpprestsdk is in maintenance mode and we do not recommend its use in new projects. We will continue to fix critical bugs and address security issues.
Dima
klimi, you are so soft hearted..
Dima
/ban @dxykbczf bye all
Sebas Tian
lmao
Dima
we’re just tired of spam and scam accounts
Dima
I feel em from 10 km away
neovstan
He’s Russian
Anshul
can anyone suggeest a good place to read about rapidjson lib in c++? i am not able to understand it through official doc
Marlo
How can i remove in visual studio this : Press any key to close this window...??
mito
How can i remove in visual studio this : Press any key to close this window...??
https://stackoverflow.com/questions/17897736/avoiding-press-any-key-to-continue-when-running-console-application-from-visua
Eyal
Can someone share options ?
klimi
i would go with tcp
Marlo
Any website that i can search for any examples for c program? (Structs, arrays, functions, pointers)
Steven
cpprefence
reference
Marlo
Thank you guys!!
后藤
Do i need to write a cuda headfile when compile multi-source-file written by c++ and cuda? When i learn about some project like KinectFusion,I find that there's no cuda head file but have no idea about why.
N
Hello everyone i want to start game development in c++ but the issue is i use macbook and most of the YouTube tutorials teaches in respect to windows could you tell me how can i use graphics in my programs
Narch
#include <iostream> using namespace std; string GuyName = "Alex"; int age = 27; int main() { cout << "This is " << GuyName << "and he is " << age << endl; return 0; }
Narch
I tried to compile this, it compiles just fine, but when I try to execute this in vscode it doesn't output anything, am I doing something wrong?
Deepak Chaurasia
Than run
Narch
Than run
Appreciate it, but it still doesnt work. Nothing is wrong with my syntax right?
Deepak Chaurasia
Problem in your vs environment
Edward
#include <iostream> #include <string> using namespace std; int main() { string GuyName = "Alex"; int age = 27; cout << "This is " << GuyName << "and he is " << age << endl; return 0; }
นะวู
Does anybody knows how to convert this to recursion? #include<stdio.h> int main() { int T,N; int sum; scanf("%d",&T); int i,j; for(i=0;i<T;i++){ sum=0; scanf("%d",&N); int A[N]; for(j=1;j<=N;j++){ scanf("%d",&A[j]); sum=sum+A[j]; } printf("Case #%d: %d\n",i+1,sum); } return 0; }
Narch
try
Shucks, still doesnt work. I think its something with the vscode, ill try figure it out. Thanks tho
Narch
Do global templates exist ?
Haven't learn that far yet
Narch
what error?
Doesn't show any errors, so I am assume its logic error
Narch
Oddly, i tried it on codeblock and it works just fine, huh
Narch
Something with vscode I guess
Narch
Apologies for the inconvinience, my fault I didnt try with another IDE
Ilya
Does anybody knows how to convert this to recursion? #include<stdio.h> int main() { int T,N; int sum; scanf("%d",&T); int i,j; for(i=0;i<T;i++){ sum=0; scanf("%d",&N); int A[N]; for(j=1;j<=N;j++){ scanf("%d",&A[j]); sum=sum+A[j]; } printf("Case #%d: %d\n",i+1,sum); } return 0; }
int calculateSum(int step) { if (step <= 0) return 0; int val; scanf("%d", &val); return (val + calculateSum(--step)); } int main() { int T, N; int sum; scanf("%d", &T); int i, j; for (i=0; i<T; i++) { scanf("%d", &N); sum = calculateSum(N); printf("Case #%d: %d\n", i + 1, sum); } return 0; }
Anonymous
Notes c programing
Anonymous
🤬😡🤬😡 bad bot !!!
N
https://www.sfml-dev.org/
Can i use graphics.h library in c++ on vscode mac?
Sheikh Hamim
some problem?
why warning?
klimi
why warning?
not following the rules about asking for other languages
touhou
Doesn't show any errors, so I am assume its logic error
how do you compile and run your code in vscode ? Give those details.
mito
#cpp #include <iostream> class Base { private: std::string uwu = "uwu"; public: std::string func(){return uwu;} }; class Derived: public Base { private: std::string owo = "owo"; public: std::string func(){return owo;} }; int main() { Base *a = new Base(); std::cout << a->func() << std::endl; a = new Derived(); std::cout << a->func() << std::endl; return 0; } Output: uwu uwu Shouldn't the second one be owo because of function overloading ? Maybe it has something to do with the Base pointer a ?
Steven
otherwise a-> can only interpreted as Base
mito
otherwise a-> can only interpreted as Base
I assume because of Base *a; So in which cases would function overloading work without using a virtual function ?
Steven
you need to declare a new variable other than a
Steven
Derived *b = new Derived();