coal
or even a non terminal itself (which wont/never affects at all, independent of the c++ standard version), then you probably mean something that is std independent or something trivial
Nothing
Hello everyone
Can anyone send me past university exams for c programming
PakitoPaskal🫵🏻
Hi friend
PakitoPaskal🫵🏻
Is there anyone who can start a blockchain node for a fee?
klimi
i thought anyone could start blockchain if they wanted no?
PakitoPaskal🫵🏻
Node
klimi
Just start one on your pc
PakitoPaskal🫵🏻
I don't have the skills
Anonymous
Hey
Anonymous
Please which compiler are you guys using
Anonymous
gcc
Anonymous 🇪🇦
coal
clang is like the cousin of g++
coal
but they're not the same thing
coal
oh and clang is more descriptive
Esan
Hello, I am running a large data set in a for loop that exceeds the maximum number of array. (Over 10^8 integers). Does anybody knows any approach to store my data into smaller sizes to optimize memory.
Esan
Thanks in anticipation
Amrith
oh and clang is more descriptive
Why does this matter ? I heard a lot about GCC LLvm clang etc but I don't really know why it matters or how to use them?
PakitoPaskal🫵🏻
-.-
SAHIL
Should i take coding ninjas course
DEV 7
Suppose the following values are inserted into a binary tree, in the order given:
12,7,9,10,22,24,30,18,3,14,20
Draw a diagram of the resulting binary tree
klimi
Suppose the following values are inserted into a binary tree, in the order given:
12,7,9,10,22,24,30,18,3,14,20
Draw a diagram of the resulting binary tree
?
Anonymous
Anyone know functions in ncurses for mouseevents ?
Anonymous
Pavel
What
https://en.wikipedia.org/wiki/GNU_Compiler_Collection
Pedro
Dr
Recursion?
Recursion requires more memory than iterating
Dr
Recursive functions increase the activation record and thus the stack memory
Pedro
Pedro
while(foo.currrent()){ foo.exec()}
Suka
Esan
Esan
Don Peter Joseph
#include <stdio.h>
#include <stdlib.h>
struct frame
{
int value;
int count;
};
int getlfu(struct frame *f, int n)
{
int max = 0;
for (int i = 0; i < n; i++)
{
if (f[i].value == -1)
return i;
if (f[max].count < f[i].count)
{
max = i;
}
}
return max;
}
int main()
{
int i, j, nop, n, hit = 0, fault = 0, pos = 0, flag = 0, choice, x = 1000;
printf("Enter the no of frames in main memory:");
scanf("%d", &n);
printf("Enter the no of values in reference string");
scanf("%d", &nop);
int page[nop];
struct frame f[n];
printf("Enter the refernce string:");
for (i = 0; i < nop; i++)
{
scanf("%d", &page[i]);
if (i < n)
{
f[i].value = -1;
f[i].count = 0;
}
}
for (i = 0; i < n; i++)
{
f[i].value = -1;
f[i].count = 0;
}
for(i=0;i<nop;i++)
printf("%d ",page[i]);
fault=hit=0;
for (i = 0; i < nop; i++)
{
for (j = 0; j < n; j++)
{
printf("page[%d] is %d and f[%d].value is %d\n",i,page[i],j,f[j].value);
if (page[i] == f[j].value)
{
flag = 1;
hit++;
f[j].count=0;
for (int k = i + 1; k < nop; k++)
{
if (f[j].value == page[k])
break;
else
f[j].count++;
}
for (int k = 0; k < nop && f[k].value != -1; k++)
{
if (k != j)
f[k].count--;
}
break;
}
}
if (flag == 0)
{
pos = getlfu(f, n);
f[pos].value = page[i];
fault++;
f[pos].count = 0;
for (int k = i + 1; k < nop; k++)
{
if (f[pos].value == page[k])
break;
else
f[pos].count++;
if (k == nop - 1)
f[pos].count = --x;
}
for (j = 0; j < n && f[j].value != -1; j++)
{
if (j != pos)
f[j].count--;
}
}
printf("\n");
flag = 0;
for (j = 0; j < n; j++)
{
if (f[j].value != -1)
printf("%d ", f[j].value);
else
printf("- ");
}
printf("\n");
}
printf("fault:%d hit:%d hit ratio:%d/%d\n", fault, hit, hit, hit + fault);
for(i=0;i<nop;i++)
printf("%d ",page[i]);
}
Don Peter Joseph
#include <stdio.h>
#include <stdlib.h>
struct frame
{
int value;
int count;
};
int getlfu(struct frame *f, int n)
{
int max = 0;
for (int i = 0; i < n; i++)
{
if (f[i].value == -1)
return i;
if (f[max].count < f[i].count)
{
max = i;
}
}
return max;
}
int main()
{
int i, j, nop, n, hit = 0, fault = 0, pos = 0, flag = 0, choice, x = 1000;
printf("Enter the no of frames in main memory:");
scanf("%d", &n);
printf("Enter the no of values in reference string");
scanf("%d", &nop);
int page[nop];
struct frame f[n];
printf("Enter the refernce string:");
for (i = 0; i < nop; i++)
{
scanf("%d", &page[i]);
if (i < n)
{
f[i].value = -1;
f[i].count = 0;
}
}
for (i = 0; i < n; i++)
{
f[i].value = -1;
f[i].count = 0;
}
for(i=0;i<nop;i++)
printf("%d ",page[i]);
fault=hit=0;
for (i = 0; i < nop; i++)
{
for (j = 0; j < n; j++)
{
printf("page[%d] is %d and f[%d].value is %d\n",i,page[i],j,f[j].value);
if (page[i] == f[j].value)
{
flag = 1;
hit++;
f[j].count=0;
for (int k = i + 1; k < nop; k++)
{
if (f[j].value == page[k])
break;
else
f[j].count++;
}
for (int k = 0; k < nop && f[k].value != -1; k++)
{
if (k != j)
f[k].count--;
}
break;
}
}
if (flag == 0)
{
pos = getlfu(f, n);
f[pos].value = page[i];
fault++;
f[pos].count = 0;
for (int k = i + 1; k < nop; k++)
{
if (f[pos].value == page[k])
break;
else
f[pos].count++;
if (k == nop - 1)
f[pos].count = --x;
}
for (j = 0; j < n && f[j].value != -1; j++)
{
if (j != pos)
f[j].count--;
}
}
printf("\n");
flag = 0;
for (j = 0; j < n; j++)
{
if (f[j].value != -1)
printf("%d ", f[j].value);
else
printf("- ");
}
printf("\n");
}
printf("fault:%d hit:%d hit ratio:%d/%d\n", fault, hit, hit, hit + fault);
for(i=0;i<nop;i++)
printf("%d ",page[i]);
}
Could anyone help me with this. The value of page[i] is changing at the end but i didn't even modify it. Some help please
Arnold
printf("Enter the no of values in reference string");
scanf("%d", &nop);
int page[nop];
Lol, I had no idea you could do this, I always used malloc
Arnold
Anonymous
Sorry Guys am a beginner in C++ can any of you help this
Write a CPP program to implement binary tree.
Pavel
klimi
Anonymous
klimi
i am not able to understand your message
klimi
"long term code during the implementation of binary tree"
CALVIN
Please help guys....
I'm interested in printing the output on an excel document..... But after running the program.... I found nothing happened when opening the excel document......
klimi
you are missing a verb
klimi
CALVIN
klimi
are you using some library for the excel or?
Pavel
I'm afraid to write here because there are a lot of rules 😐
Well, the most gereric thing is don't ask to do your work for you (homework, test, etc.). Asking good questions is difficult, but learning this can be very beneficial (really, so many people don't get good answers in these chats because they asked their questions poorly).
Of course, don't do some generally not nice things like: sending adverts, non-english, nsfw, off topic or spaming, I think this should be logical.
Don't ask for, or propose pirated content.
Other stuff in the rules is just specific repeatedly happening cases that people got annoyed with like questions "hack Instagram account for me plz".
%Nikita
Well, the most gereric thing is don't ask to do your work for you (homework, test, etc.). Asking good questions is difficult, but learning this can be very beneficial (really, so many people don't get good answers in these chats because they asked their questions poorly).
Of course, don't do some generally not nice things like: sending adverts, non-english, nsfw, off topic or spaming, I think this should be logical.
Don't ask for, or propose pirated content.
Other stuff in the rules is just specific repeatedly happening cases that people got annoyed with like questions "hack Instagram account for me plz".
Oh, and that sort of things. I understood, thx
Pavel
Oh, and that sort of things. I understood, thx
And about the homework stuff, it's still fine to ask specific questions like "I need to do A, to do that I did B, I expected to get C as a result, but get D. Why?" even if this homework this is fine because
A) you demonstrated that you made effort to solve it yourself and B) asked specific question about the problem you want to solve (with describing some useful information about the problem: what you tried, expected, got)
𝕷𝖔𝖗𝖊𝖓𝖟𝖔
Guys is it possible to ask a question about C software efficiency? It's an exam question about a C code we had to write, and then there's a theoretical question about code efficiency
𝕷𝖔𝖗𝖊𝖓𝖟𝖔
if it is ok I'll send you the question, I managed to write the code (it was pretty easy) but I find it hard to solve the theoretical question
%Nikita
And about the homework stuff, it's still fine to ask specific questions like "I need to do A, to do that I did B, I expected to get C as a result, but get D. Why?" even if this homework this is fine because
A) you demonstrated that you made effort to solve it yourself and B) asked specific question about the problem you want to solve (with describing some useful information about the problem: what you tried, expected, got)
A real programmer - distributed a good question into variables A,B,C,D, wrote everything into an array and iterated with all of them. Thanks!
Half Blood Prince
Anyone interested in pair programming in dsa or web dev
Half Blood Prince
Dm me
Anton
Hi everyone! I'm trying to detect which C standard is defined to run my code in header file.
According to IMB on standard predefined macro-names:
"__STDC_VERSION__ (C only)
The integer constant of type long int: 199409L for the C89 language level, 199901L for C99. Note that this macro is only defined if __STDC__ is also defined."
But so far it yields no result. What am I doing wrong here?
header.h
#define <stdio.h>
#if defined(__STDC__)
#if STDC_VERSION >= 199901L
#define OPTION 1
#endif
#if STDC_VERSION == 199409L
#define OPTION 2
#endif
#endif
main.c
#include "header.h"
int main(void)
{
printf("%i\n", OPTION);
return (0);
}
Anonymous
Anton
Anonymous
Hello .... where can I find books, videos or documents that teach modern C ++?
Anton
Anonymous
Hello can you help me in opengl
Anonymous
?:??
Anonymous
#question
Is there any library to automatically convert json to the object of type MyClass?
in java the Gson do it easily
%Nikita
Hey, guys!
I am trying to calculate some expression using asin() function in C.
When I try to print it like this:
printf("expr = %lf", result);
It prints
expr = nan
Why not a number printing, can asin() from <math.h> return "nan"?
I checked all my expression, but it still returns nan.
Here it is:
double result = asin((i - a.y) / radius) + (grad * M_PI / 180.0);
radius is double
a.y is int
grad is double
i is int
Radius is not a 0. With some values a.y and radius I have result nan, with other - a basic number result.
What am I doing wrong?
Pavel
%Nikita
%Nikita
Anonymous
How can I make that
Can I use models for example?
temp
why i am getting compiler error? Does stream extraction operator don't work inside lambda function?
temp
#include<iostream>
using namespace std;
int main() {
int arr[5];
for (int i{}; i < 5; i++)
cin >> arr[i]; //work here
auto initilaize = [arr] {
for (int i{}; i < 5; i++)
cin>>arr[i]; //don't work here
cout <<'\n';
};
initilaize();
return 0;
}
Pavel