Hermann
Anonymous
Guys Would somebody help me please? Im coding some simple employee MENU. I have and employee array with some hardcoding setting up some employees isEmpty variable to 0 but my function to show employees ALSO shows those elements of the array which its isEmpty is == 1
Anonymous
in the printEmployee function I do ask about those employees which isEmpty is == 0 but nonetheless
Anonymous
shows all :S
Anonymous
any hints?
Dima
you could post your code snippet
Anonymous
Can I post it just like that or should I paste it as pastebin?
Dima
if it’s long enough then use pastebin
Anonymous
it's short but just to leave things simple I created a pastebin
Anonymous
https://pastebin.com/mX2JNnPW
Anonymous
there's the hardcode function and the showEmployee function... for some reason it shows also the empty employees. My employee array is = 1000
Anonymous
I think it's a logic problem... I set up de hardcoding and every array (id, isempty etc..) now holds 1000 elements. But the problem continues UNLESS i ask for isEmpty == 1 && id == 0 in printEmployees.
But why isEmpty == 1 isn't enough?
Anonymous
I forgot to mention that I init everything as:
Anonymous
int initEmployees(Employee list[], int len){
for(int x = 0; x<len;x++){
list[x].isEmpty = 1;
}
return 0;
}
Dima
oh
Anonymous
wait... when I call init from main I pass only the array
Anonymous
Employee empleados[ELEMENTS];
initEmployees(empleados, ELEMENTS);
hardCodearEmployees(empleados, ELEMENTS);
Dima
are you using C or C++?
Anonymous
isnt employees here being passed as reference? initEmployees(empleados, ELEMENTS);
Anonymous
C, just learning
Dima
oh, I thought c++ lol
Anonymous
nop ansi C
Artöm
Anonymous
Ok guys I solved my problem XD
Sasuke
To start creating Linux drivers should I first read about Data structures and Algorithms?
Anonymous
Sasuke
Anonymous
you're right it isnt!!! I dont think vim has those space lines
Anonymous
probably codeblocks
Anonymous
too bad!
Anonymous
I like my vim's theme but that looks dope too!
Supernoobuser
Do you know a good book about winsock2?
ʟᴏɴᴇᴡᴏʟꜰ
.
Hi
Kyc
Write a C program that uses functions. The main() method holds an integer variable named numberOfEggs to which you will assign a value. Create a method called myEggs() to which you pass numberOfEggs. The method displays the eggs in dozens; for example, 50 eggs is 4 full dozen (with 2 eggs remaining).
Kindly assist..
klimi
Kyc
I have only one hour for the task plz
klimi
I dont think people will write it for you mate
klimi
Kyc
Best pc app for coding c?
Rania
klimi
Vishnu
Best pc app for coding c?
Well there's this proprietary software called c lion of jetbrains if you wanna give it a shot
pappupanchi
Cam anyone suggest me a good free ide for c/c++ I am a student
klimi
Anonymous
pappupanchi
Ok
Anonymous
.
Oumi koursiou
Thanks again all users
Albert
Hi guys, I'm looking for a light and simple library to draw graphs inside a window. I found that Qt have something named Elastic Nodes, but Im looking for a simple alternative. Can you give me any suggestion? thank you.
Nomid Íkorni-Sciurus
Francisco
Asad
I want to pass a vector of arbitrary type to Bill() function. However, push_back() is not working. Is there any way to do/improve it?
Tushar Goel
#include<stdio.h>
int main()
{
int n;
scanf("%d",&n);
int result;
result=tribonacci(n);
printf("%d",result);
}
int tribonacci( int n){
if(n==0)
return 0;
if(n==1)
return 1;
if(n==2)
return 1;
else
{
int e;
e=tribonacci(n-1)+tribonacci(n-2)+tribonacci(n-3);
return e;
}
}
Tushar Goel
The issue is-time limit exceeded when the input is 36 or more
Tushar Goel
please guide me
Artöm
Rewrite it without recursion
Artöm
Tushar Goel
So what should I do then
Anonymous
Anonymous
Or may be dp
Tushar Goel
What is golden ratio and dp?
Tushar Goel
Ya this is tribonacci
Asad
I thought this would work
Artöm
Yes
Artöm
It will with if constexpr but I see no need in templatizing this
Asad
Artöm
As several overloads
Asad
Yup it is weird. I actually got it from google and the original form was:
template<class T, class A>
void Foo(std::vector<T, A> vec);
Asad
Huh, I understand now
Dima
/ban 1166772550
Asdew
Is this a new thing?
Anonymous
Why is the time complexity of insertion of an element in an unordered map is linear? Is it something because of the hash?
Anonymous