Φ ☭
/get cppbookguide
Hanz
Guys, what is this thing called, its so weird:
[](args...) { /* body */ }
Andrew
Hanz
I mean, what is it exactly?
Anonymous
closure is what its called
Hanz
Hanz
I see that this passed as argument, how is it possible too 😂
Anonymous
there are some functions in std::algorithms that use closures
Jen
WTF are you doing?
You mean the actual program? If not then it was a silly mistake. Sorry.
Jen
I have a book thanks. It's not like I didn't knew the rules. I don't know how but I made a stupid mistake and my mind couldn't catch it.
Anonymous
Talula
Homework?
Talula
Read the rules and delete before you getting a warning.
Henry
Which book do u suggest best for C language
Anonymous
The c programming language
Henry
Author??
Anonymous
Brian W. Kerninghan
Adarsh
#include<bits/stdc++.h>
using namespace std;
int table[256];
void initialize()
{
table[0]=0;
for(int i=0;i<256;i++)table[i]=(i&1)+table[i/2];// can anyone explain this line
}
int count(int n)
{
int res=table[n&0xff];
n=n>>8;
res=res+table[n&0xff];
n=n>>8;
res=res+table[n&0xff];
n=n>>8;
res=res+table[n&0xff];
return res;
}
int main()
{
initialize();
cout<<count(40);
return 0;
}
Anonymous
fun(){
int n;
scanf("%d", &n);
for(int i=0; i<10^6; i++)
printf("hello");
}
what is rate of growth and time complexity for above block of code...?
Apk
Anonymous
Constant
u mean O(1) or O(10^6) ?
Apk
Anonymous
They are same
yeah they both are constant...so bot the answer is correct?
Apk
Apk
Just ask the question
Anonymous
Anonymous
/rules
Anonymous
/rules
Anonymous
2n-2
n is the number of nodes...
Anonymous
yes...
Andrew
just ask
Emmanuel
Thanks
Anonymous
for cerr u can read the below article at
https://www.geeksforgeeks.org/cerr-standard-error-stream-object-in-cpp/
Anonymous
to answer x==first, I will hv to see the code
what I have understood, I think first is the head node of any linked list and x is the newly created node...
Anonymous
okay I hv not idea about it, so I can't ans right now bro...
Yuichi
whaaattt
Dan
/get cbook
Anonymous
Okay so it is function to delete any node from a linked list except the head node...
'x' is a pointer pointing to a node which is to be deleted...
And 'first' is a pointer pointing to the head node of linked list...
We are checking if 'x' is pointing to the head node or not by comparing with 'first' i.e [ if(x==first) ]...
If 'x' is pointing to head node then, 'x' and 'first' pointers will have same address and then the message 'deletion of head node is not allowed' will be outputted and if 'x' is not pointing to head node then that node will be deleted...
Anonymous
AR
/get ide
AKILA
Yeah, I can help u
AKILA
🤔
Anonymous
Show code
barungh
What is the problem ?
Victor
AKILA
Is learning c worth?
AKILA
👍
Anonymous
AKILA
Anonymous
Why
You should not be writing any new code in C
AKILA
Anonymous
Then?
Legacy codebases can benefit from some knowledge of C
AKILA
Anonymous
In that case just delete that part of the code which you're updating
Anonymous
And rewrite it in something sane if it is possible
Yuichi
The Shadow Monarch
Anonymous
yes because BMI is the name of the class
Anonymous
you cannot just compare it to a number like that
Benjamin
/rules
Benjamin
john
#include <stdio.h>
int main()
{
char Name[20];
char lname[20;]
float Math;
float English;
float Science;
FILE *fp;
fp = fopen ("Student.txt","a");
printf("Enter \"exit\" as First Name to stop reading user input.");
fprintf(fp," Name");
fprintf(fp," Math ");
fprintf(fp," English ");
fprintf(fp," Science");
fprintf(fp," Average \n");
while (1)
{
printf("\nStudent First Name: ");
scanf ("%s",Name);
if (strcmp(Name, "exit") == 0)
exit(1);
printf("\nStudent Last Name: ");
scanf ("%s",lname);
printf("Math marks: ");
scanf ("%f", &Math);
printf("English mark : ");
scanf ("%f", &English);
printf("Science Marks : ");
scanf ("%f", &Science);
float sum=Math+English+Science;
float Avg=sum/3 ;
fprintf(fp," %s %s ",Name,lname);
fprintf(fp," %f ",Math);
fprintf(fp," %f ",English);
fprintf(fp," %f ",Science);
fprintf(fp," %f \n",Avg);
}
fclose(fp);
FILE *fp;
fp = fopen ("Student.txt","r");
return 0;
}
john
how do i read only the average
The Shadow Monarch
john
mayway
Anyone can give link of friends reunion
klimi
Aditi
/get
Ehsan
/notes
Ehsan
#best-book
Talula
In Hindi tone of your voice changes statement, answer or question... the sentence remains the same.
Ehsan
#noendl
Ehsan
#c++_isnt_c_with_classes