Anonymous
i used this
Anonymous
hey can someone tell me why my this code is causing runtime erroe
AR
/get goodgoogling
Adarsh
Brian kerningan's Algorithm is used to find number of set bits in a number?
Adarsh
int countSetBits(int n)
{
int res=0;
while(n>0)
{
n=(n&(n-1));
res++;
}
return res;
}//but i'm getting wrong output for 30
Andrew
Ama Ni
Exponential function or exp(x) = ex
is a mathematical function learned in calculus. ex
can be
represented as a power series ex
= 1 + x + x2
/ 2! + x3
/ 3! + … + xn
/ n! + … and n factorial
n! = n*(n-1)*(n-2)* … *3*2*1.
Write a computer program which compute and display e
10 using for loop.
Please help 🙏🙏
I Need the code for this question.
Andrew
Anonymous
In a class I have allocated the memory using the (new) keyword and I want to deallocate the memory when I want can I create a function in which Iam deleting the memory I allocated ?
Please guide me
Suka
Ama Ni
Adarsh
working fine in my pc.
Geeksforgeeks is showing error in it's compiler .....it is working fine on my vs code
Jan
What error is it showing?
Suka
Adarsh
Sharing media ia not allowed in this group
Jan
Then type the error out
Apk
Adarsh
Paste the error
Wrong Answer. !!!Wrong Answer
Possibly your code doesn't work correctly for multiple test-cases (TCs).
The first test case where your code failed:
Input:
30
Its Correct output is:
75
And Your Code's output is:
4
Suka
Sabyasachi
What is struct in C?
George
/get cppbookguide
0x1FE6C
Please my code gives me errors after taking the input. Help me figure out what is the cause thanks https://pastebin.com/rPWWFWZy
0x1FE6C
Error shown https://pastebin.com/7PkQdGCe
0x1FE6C
Md Shahadat
please i have a request create playlist or topic list like tutorials in c++ please so we can get at least something.
Md Shahadat
thank you but please can you provide like topic list so we can read
Pradevel (Pratyush)
May I know what /get does?
Yasas
/get
Diego
Yasas
/get cpp-vscode
Diego
This is a good introduction to the language
Diego
The english and the introductory statement are a bit mmmmeeeehh, though
Diego
Take everything you read from "C++ is a must for students and professionals to become great Software Engineers", to "Loved by millions" and "Never sit without work" bits with several grains of salt
Anonymous
how to use atof function in c
Aarthy
Define a function which takes ranges of numbers as defined by two parameters,start,end both inclusive.
Find the count of numbers in the range that donot have 5 as one of its digits using C..
Eg: 1,8 =>7
Aarthy
Viney
https://docs.google.com/forms/d/e/1FAIpQLScWxoGUOG5wO0gLo_FOK6hWn-ByOXNdGMLfGTqrv4reKmOW4Q/viewform?usp=sf_link
klimi
Viney
Internship program for interns
klimi
It feels like promotion to me
klimi
Are you sure you are complying with the rules?
Anonymous
seems very sketchy too lol
B220059_Subhra_Bhanja
Alice and Bob each created one problem for HackerRank. A reviewer rates the two challenges, awarding points on a scale from 1 to 100 for three categories: problem clarity, originality, and difficulty.
The rating for Alice's challenge is the triplet a = (a[0], a[1], a[2]), and the rating for Bob's challenge is the triplet b = (b[0], b[1], b[2]).
The task is to find their comparison points by comparing a[0] with b[0], a[1] with b[1], and a[2] with b[2].
If a[i] > b[i], then Alice is awarded 1 point.
If a[i] < b[i], then Bob is awarded 1 point.
If a[i] = b[i], then neither person receives a point.
Comparison points is the total points a person earned.
Given a and b, determine their respective comparison points.
B220059_Subhra_Bhanja
#include <stdio.h>
#include <stdlib.h>
int a[3], b[3];
int i=0, j=0 ;
int compareTriplets (int a[], int b[]);
int compareTriplets (int a[], int b[] )
{
int m, n;
for(i=0;i<3; i++)
{
for(j=0; j<3; j++)
{
if (b[j] > a[i])
m++;
else if(a[i] > b[j])
n++;
}
printf("%d %d", m, n);
return 0;
}
}
int main() {
char temp1,temp2;
do {
scanf("%d%c", &a[i], &temp1);
i++;
} while(temp1 != '\n');
for(i=0; i<3; i++) {
printf("%d ", a[i], temp1);
}
do {
scanf("%d%c", &b[j], &temp2);
j++;
} while(temp2 != '\n');
for(j=0; j<3; j++) {
printf("%d ", b[j], temp2);
}
return compareTriplets( a[i], b[j]);
}
CAN SOMEONE FIX THIS?
Mahi_way❤
Any experts in Ubuntu?
I am facing some problems in it😕
Nagarajan GK
#include <stdio.h>
#include <stdlib.h>
int a[3], b[3];
int i=0, j=0 ;
int compareTriplets (int a[], int b[]);
int compareTriplets (int a[], int b[] )
{
int m, n;
for(i=0;i<3; i++)
{
for(j=0; j<3; j++)
{
if (b[j] > a[i])
m++;
else if(a[i] > b[j])
n++;
}
printf("%d %d", m, n);
return 0;
}
}
int main() {
char temp1,temp2;
do {
scanf("%d%c", &a[i], &temp1);
i++;
} while(temp1 != '\n');
for(i=0; i<3; i++) {
printf("%d ", a[i], temp1);
}
do {
scanf("%d%c", &b[j], &temp2);
j++;
} while(temp2 != '\n');
for(j=0; j<3; j++) {
printf("%d ", b[j], temp2);
}
return compareTriplets( a[i], b[j]);
}
CAN SOMEONE FIX THIS?
#include <stdio.h>
#include <stdlib.h>
int compareTriplets(int a[], int b[]) {
int m, n;
int i = 0, j = 0;
for (i = 0; i < 3; i++) {
for (j = 0; j < 3; j++) {
if (b[j] > a[i])
m++;
else if (a[i] > b[j])
n++;
}
}
printf("%d %d", m, n);
return 0;
}
int main() {
int a[3], b[3];
char temp1, temp2;
int i = 0, j = 0;
do {
scanf("%d %c", &a[i], &temp1);
i++;
} while (i < 3);
for (i = 0; i < 3; i++) {
printf("%d %c \n", a[i], temp1);
}
do {
scanf("%d %c", &b[j], &temp2);
j++;
} while (j < 3);
for (j = 0; j < 3; j++) {
printf("%d %c \n", b[j], temp2);
}
return compareTriplets(&a[i], &b[j]);
}
Nagarajan GK
B220059_Subhra_Bhanja
#include <stdio.h>
#include <stdlib.h>
int compareTriplets(int a[], int b[]) {
int m, n;
int i = 0, j = 0;
for (i = 0; i < 3; i++) {
for (j = 0; j < 3; j++) {
if (b[j] > a[i])
m++;
else if (a[i] > b[j])
n++;
}
}
printf("%d %d", m, n);
return 0;
}
int main() {
int a[3], b[3];
char temp1, temp2;
int i = 0, j = 0;
do {
scanf("%d %c", &a[i], &temp1);
i++;
} while (i < 3);
for (i = 0; i < 3; i++) {
printf("%d %c \n", a[i], temp1);
}
do {
scanf("%d %c", &b[j], &temp2);
j++;
} while (j < 3);
for (j = 0; j < 3; j++) {
printf("%d %c \n", b[j], temp2);
}
return compareTriplets(&a[i], &b[j]);
}
it shows garbage value after printing the elements of array a and b.
Anonymous
Google it
I already did that anyway thanks buddy 😄
Nagarajan GK
Ni
could anyone explain the difference of the followin two declaration:
int (* pz)[2];
int * pax[2];
I got them in C primer plus, which says the pz points to an array of 2 ints, and pax is an array of two pointers-to-int, but I can't understand why, I don't know how to google it, so I came here for help
Jasur Fozilov 🐳
Ni
B220059_Subhra_Bhanja
Code updated
it still shows some garbage value after taking input
AKILA
How to learn lonked list well 🤯
Pavel
How to learn lonked list well 🤯
Have you learned pointers? If no, start to learning about them first.
If you feel comfortable with pointers I would advise to search for a video on YouTube with explanation about linked lists. There are many of them, watch a couple then try to implement it yourself.
AKILA
J.K. – Tessier-Ashpool Customer Support
Hi all!
ㅤ
If i want to create an array which contains different classes and i can use their methods without using stl what do i have to do?
Pavel
ㅤ
Where should be 3 different classes, but the array itself must be bigger (a class can repeat itself in the array)
J.K. – Tessier-Ashpool Customer Support
I'm running a series of challenges of reversing, for which I'm new at. I'm using Ghidra to analyze an ELF-64 file. It gives me some wacky C as it could and I'm trying to get it as best as I can. I've been searching very hard in Google to get all solved, but there are some still unanswered questions. What do these mean?
undefined8 local_48;
[some code here]
local_48 = 3706296898382101353;
[more irrelevant code there]
strncmp(argv[1], (char *)&local_48, 34);
To me, being local_48 a length 8 type in that format (originally that value in HEX) maybe it's a long (I have my doubts). But I don't get what's actually going on at the second parameter of strncmp().
J.K. – Tessier-Ashpool Customer Support
Is it casting a mem address to a char pointer/string?
Ammar
J.K. – Tessier-Ashpool Customer Support
Pavel
Where should be 3 different classes, but the array itself must be bigger (a class can repeat itself in the array)
You can implement your own version of std::variant (e.g. using tagged union).
If they share a common interface or a base class you can store pointers to the base class in the array.
There is also way with storing void* and custom deleter functions (basically making your custom std::any).
If you choose any of the ways don't forget to encapsulate the logic (in a class if it's C++) so the user of this container won't deal with low level details
J.K. – Tessier-Ashpool Customer Support
Ammar
Ammar
Ammar
- &local_48 is the address of local_48.
- local_48 is the value of the variable.
Ammar
J.K. – Tessier-Ashpool Customer Support