Pavel
map<int, int> map;
Then there's no difference (except the values), a more fancy modern way however would be to use emplace instead of insert in this specific case, so the element will be constructed in-place
map.emplace(2, 30);
Anonymous
Anonymous
Martin
Anyone know how to implement my own ranges::views? I'm trying to implement an equlivent to Python's map in C++20. But got stuck writing my own ranges
Anonymous
J
I have a Linux Question.
Could I get the virtual page id from a virtual address? In a way, the virtual addresses on the same page is mapped to the exact same virtual page id as well as the physical page id.
Somehow I want a reserved version of page_address() in the linux kernel.
Anonymous
Any body help me with examples about pointer and array relationships
Anonymous
Shahrukh
Leovan
Who knows, some literature about WYSIWYG editors? I'm want know how to parse (render) MarkDown using C++ (without libraries) in real time. I'm thinking about using regular expressions, any better ideas?
Prince Fine
Can some one recommend me what to search on YT for telegram scripting using C++
redfox
hi
redfox
i have just started learning classes in cpp
redfox
and i cannot seem to find what is the use of ~ in classes in cpp
Leovan
redfox
Destructor
right now im learning Static member functions
redfox
do destructors have something to do whit Polymorphism?
Leovan
do destructors have something to do whit Polymorphism?
Every class has destructor (even if you don't create it - compiler will generate default). About polymorphism: every class which assumes inheritance from itself must have a virtual destructor, because child classes can add new variables which parent class can't delete in his destructor
Marina
does anyone know how to format a string adding a space in c?
Marina
Marina
thank you!
Farivar
Hey Guys 👋🏻,
i want to store struct in a file multiple times but i don't know how can some one help me?
struct newRecord
{
int id;
char *First_name;
char *Last_name;
int SSN;
int Age;
bool History_of_diabetes;
bool History_of_heart_disease;
};
struct is like this i want to store data about multiple users and thenfind them by one of the value like name or Social Security Number or ID and theh print all of that specific record from ( id to History_of_heart_disease),
can some one explain how and i will really appreciate it if you write this programs code so i can undrestand it better by working with it,
Thank You 🙏🏻;
redfox
oh well
redfox
i cant help then
klimi
this is a joke right?
Antoni
Hi :). I joined to ask something and also wish to stay for further education, im just a beginner
Antoni
I'd like to ask if there is a way to read the contents of a constructor and show them to the main() function in order to make calculations on them
Antoni
it looks like this:
buildings.h
public:
Coop(int=4000, int=300, int=100);
buildings.cpp
Coop::Coop(int g, int w, int s)
{
Gold=g; Wood=w; Stone=s;
}
Pavel
Antoni
exactly as u described, then i want to compare the materials the user enters earlier to those needed to build the coop and tell how many of them can the user build
Antoni
but the hardest part so far is just showing those numbers to the main function. I could of course just write those numbers manually but im hoping theres a more elegant way
ian
does anyone know how to format a string adding a space in c?
Is this what you are looking for?
#include <stdio.h>
int main ()
{ // empty array of characters (string).
char character_array [256];
// string to be added to the format.
char added [] = "world";
// the variable "character_array" will take the value of the format specified here.
// "%s" = indicates that the variable ("added") is a string, "\n" is a line break.
// https://www.gnu.org/software/libc/manual/html_node/Table-of-Output-Conversions.html
// (https://www.gnu.org/software/libc/manual/html_node/Formatted-Output.html)
sprintf (character_array, "Hello %s in C.\n", added);
// prints the value of variable 'character_array'.
printf ("%s", character_array);
return 0;
}
Marina
Marina
but thank you! I will look at it
S
S
Antoni
klimi
can you please explain to me, what these numbers mean? to me it seems that you aree just spamming
Prince kumar
Jagadeesh
// CPP program to check if n is a multiple of 3
#include <bits/stdc++.h>
using namespace std;
int static dp[1001];
/* Function to check if n is a multiple of 3*/
int isMultipleOf3(int n)
{
int odd_count = 0;
int even_count = 0;
if (n < 0)
n = -n;
if (n == 0)
return 1;
if (n == 1)
return 0;
if(dp[n] != -1)
return dp[n];
while (n) {
if (n & 1)
odd_count++;
if (n & 2)
even_count++;
n = n >> 2;
}
dp[n] = isMultipleOf3(abs(odd_count - even_count));
return dp[n];
}
int main()
{
int num = 24;
memset(dp, -1, sizeof(dp));
if (isMultipleOf3(num))
printf("%d is multiple of 3", num);
else
printf("%d is not a multiple of 3", num);
return 0;
}
can anyone explain why they are using if(dp[n] != -1) in that place...
Jøhn
mito
Jagadeesh
Hima
S
Some programs veriose versions do not do the same as it might be right higher versions of some programs should do the job of all previouse versions but in some odd programs lower versions do some job that higher versions gives error
Am I right?
For example tdstrip v01 for me does the job and creates com program but v5.0 of it doesnot do
May you explain about this
Anonymous
can anyone tell me what is the difference and what error might occur when I use
int *x;
x = new int;
*x = 10;
and
int *x;
x = new int();
*x = 10;
Anonymous
okay thank you for explaining in details...🙂
Burak
how can I make a tool that helps to arrange the voice of anyone who connected voice channel. The voice has to be realistic as if anybody sits beside me. Which technologies do you think I need to use?
klimi
David
Is it possible to port a c++ program to C programming style
coal
David
coal
to the point that it's not worth it, because there isn't really any significant benefit in using C over C++
coal
probably it's a matter of taste
David
David
coal
David
coal
yeah, you have to i guess
coal
good luck
the best for everyone
// write a program to covert from lower case to upper case phonetic characters without string function
#include <stdio.h>
int main()
{
char str[100];
printf("Enter your String(Upper case):");
scanf("%[^\n]", str);
int i = 0;
//convert capital letter string to small letter string
while (str[i] != '\0')
{
/*if (str[i] > 64 && str[i] < 91) //or if(str[i]>='A' && str[i]<='Z')
str[i] += 32;
i++;*/
if(str[i]=='a' str[i]=='e' str[i]=='i' str[i]=='o' str[i]=='u')
str[i] += 32 ; // for Asil
i++; //to go to next character of the string
}
printf("Lower case String is << %s", str);
}
the best for everyone
why this code is not working as the request
I use Arch
Its funny how Telegram replaces || by spoiler formatting
I use Arch
the best for everyone
where are you talking abut
the best for everyone
the best for everyone
// write a program to covert from lower case to upper case phonetic characters without string function
#include <stdio.h>
int main()
{
char str[100];
printf("Enter your String(Upper case):");
scanf("%[^\n]", str);
int i = 0;
//convert capital letter string to small letter string
while (str[i] != '\0')
{
/*if (str[i] > 64 && str[i] < 91) //or if(str[i]>='A' && str[i]<='Z')
str[i] += 32;
i++;*/
if(str[i]=='a' str[i]=='e' str[i]=='i' str[i]=='o' str[i]=='u')
str[i] -= 32 ; // for Asil
i++; //to go to next character of the string
}
printf("Lower case String is << %s", str);
}
the best for everyone
the best for everyone
?
Sriram
binary tree node left and right child program
Sriram
For C Program
Sriram
Anonymous
please help me
Please Solve this in C++
Q Na 3 A parking garage charges a Rs. 100.00 minimum fee to park for up to three hours. The garage charges an additional Rs. 50.00 per hour for each hour or part thereof in excess of three hours The maximum charge for any given 24-hour period is Rs1000 00 Asume that no car parks for longer than 24 hours at a time Write a program that will calculate and print the parkirg charges for each of 3 customers who parked their Cars in this garage yesterday. You should enter the hours for each cuntomer Your program should print the results in a neat tabulat format and should calculate and print the total of yesterday's receipts The prograrm should use the function int calculate Charges( double hours) to determine the charge for each customer. This function takes hours as parameters and returns the charges for each cutomer Use (setw) to print in tabular form Add the requied header file as well your out put should ppmar in the following format:
Aadarsh
Thanks