Anonymous
yes.for each item how much they have been sold out
You just need to maintain a separate running counter for each individual items which you initialize to 0 and then when an item is ordered you add them to the specific counter of the item. You dont reset it to 0 for the next customer. You go on adding to this counter and display it all together at the end. Ideally instead of maintaining separate counters, you can create classes for each item and let them do the hard work. Would make your code look better and also make it easy to make any changes in future.
Alieya MIN
classes? can be more detail? not understand little bit..
tao
You can just create a tensor directly from this input. You dont even need a file. Look at their examples. They have lots of them covering different scenarios. Not all the inputs are image files.
Could you give me a URL, I just found doc like this https://serizba.github.io/cppflow/examples.html#inference-on-efficientnet Sorry for asking this
Anonymous
nope
Then forget it.
Alieya MIN
ouhh okay thanks
Anonymous
Could you give me a URL, I just found doc like this https://serizba.github.io/cppflow/examples.html#inference-on-efficientnet Sorry for asking this
https://github.com/serizba/cppflow/blob/cppflow2/examples/multi_input_output/main.cpp Here the input is a tensor that they create using the fill method.
Anonymous
Let me studing in this. Thx a lot, having a good day!
You need to understand what tensors are. I guess you are already familiar with python and so must have used np.arrays from numpy. Tensors are the C/C++ equivalent of that. There are many ways you can create them. Look at the cppflow wrapper and see what methods are available. If not convenient, you can use the underlying Tensorflow API directly.
Code WHIZ
What is difference with size of object and size of class
Anonymous
I just submitted the solution and it was accepted. Not sure why yours is getting rejected then. Check out ID = 28128919 in the submitted solutions
Hey, it got submitted, yes, BUT, the output when I run in local/online editor, it shows only 0's just like before :/
Anonymous
Hey, it got submitted, yes, BUT, the output when I run in local/online editor, it shows only 0's just like before :/
I tried some corner cases like only 1 solution and all 100 solutions with same concentration and all. It did work fine. Online submission to SPOJ was also accepted as having passed all test cases. Not sure why it is different for you.
Anonymous
Can you show me the output?
Anonymous
I tried the border cases on my local system as well
Anonymous
I tried the border cases on my local system as well
I am not asking about the cases, it shows me 0 for sample case itself
Anonymous
I am not asking about the cases, it shows me 0 for sample case itself
No it worked fine for those as well. Hold on let me show you.
Anonymous
yes pls
you want to test any specific inputs
Anonymous
Anonymous
The samples ones, given in the question itself
Anonymous
Okay so it works :/ Will check it up again Anyway, thanks a lot for entertaining my questions!
Anonymous
Anonymous
Anonymous
sure, but who are frowned upon and why?
sharing screenshots. People used to post pictures of the screen instead of taking a screenshot. To curb the menace, attaching files is now not allowed for anyone.
Anonymous
What is difference with size of object and size of class
sizeof an object will be the same as the sizeof its class.
Code WHIZ
Why is that so because memory is allocated after object is created so for class there must be no memory. And another question why does static member memory is counted for each object its only one for whole class
Code WHIZ
sizeof an object will be the same as the sizeof its class.
There must be some difference when dealing with static member . But i cant observe it i get same size .
Anonymous
Why is that so because memory is allocated after object is created so for class there must be no memory. And another question why does static member memory is counted for each object its only one for whole class
sizeof when used with a class tells you how much memory will be taken up by the objects of the class which will be the same as sizeof an object of the class. Static members dont affect sizeof. Did you check with an example code?
Code WHIZ
sizeof when used with a class tells you how much memory will be taken up by the objects of the class which will be the same as sizeof an object of the class. Static members dont affect sizeof. Did you check with an example code?
I checked with example code . You are correct static members have nothing to with size while dealing with object . So that means we cant define size of class?
Anonymous
I checked with example code . You are correct static members have nothing to with size while dealing with object . So that means we cant define size of class?
Sizeof class like I said, gives you the size that an object of this class will take up in memory (this doesnt include heap memory allocations btw).Static members are not part of an object. Hence sizeof class or sizeof object will not be affected by them.
Code WHIZ
Is their any case when size of class and size object wont be same . And i find a website saying classes dont have any size.
Code WHIZ
A simple class for eg. Class test {int a;}; containing various member variables.
Anonymous
No a class definition defined using class keyword.
VENUJAN
#include <stdio.h> int main(){ int PhyMark = 65,MathMark = 72,ChemMark = 51; int Total_3 = PhyMark + MathMark + ChemMark; int Total_2 = PhyMark + MathMark; if (PhyMark >= 51) and (MathMark >= 65) and (ChemMark >= 50){ if (Total_3 >= 190 ) or (Total_2 >= 137){ printf("This candidate is eligible for admission") ; } else{ printf("This candidate is not eligible for admission"); } } } }
VENUJAN
#include <stdio.h> int main(){ int PhyMark = 65,MathMark = 72,ChemMark = 51; int Total_3 = PhyMark + MathMark + ChemMark; int Total_2 = PhyMark + MathMark; if (PhyMark >= 51) && (MathMark >= 65) && (ChemMark >= 50) { if (Total_3 >= 190 ) || (Total_2 >= 137) { printf("This candidate is eligible for admission") ; } else { printf("This candidate is not eligible for admission"); } } return 0; }
SR27
You should add an extra parentheses to group all the relationship operations in the if statement like if((Total_3>=190)||(Total_2>=137)) Likewise for the first if as well.
Constraints: 1 <= T <= 200 1 <= N <= 107 1 <= D <= N 0 <= arr[i] <= 105 by looking constrains how can i get to know what should be the time complexity for my code
Anonymous
Constraints: 1 <= T <= 200 1 <= N <= 107 1 <= D <= N 0 <= arr[i] <= 105 by looking constrains how can i get to know what should be the time complexity for my code
Time complexity depends on your algorithm. The constraints can then be used to determine how much time will be taken up by your algorithm from the time complexity to a constant factor. Without looking at the problem, you cant do anything with the constraints alone.
VENUJAN
whats wrong?
VENUJAN
#include <stdio.h> int main(){ int PhyMark = 65,MathMark = 72,ChemMark = 51; int Total_3 = PhyMark + MathMark + ChemMark; int Total_2 = PhyMark + MathMark; if (PhyMark >= 51) { if (MathMark >= 65) { if (ChemMark >= 50) { if (Total_3 >= 190 ) { printf("This candidate is eligible for admission"); else if (Total_2 >= 137) { printf("This candidate is eligible for admission"); } } } } } else { printf("This candidate is not eligible for admission"); } return 0; }
Anonymous
i mean by seeing constrains how can i get an idea that code should have time complexity of ....
If suppose say you have a linear complexity algorithm, and the size of inputs is 0 to 10000, then you know your algorithm will take 10 micro seconds approx on a computer that can execute 10^9 instructions per second. If the input size is 10^9, then for the same algorithm your time limit will be 1s or more which would give you a TLE error on most competitive programming sites(I guess you are a competitive programmer). Then you know that there must be a sub linear possibly logarithmic complexity algorithm and so on.
OnePunchMan
const int a = 3; const int *ptr_to_a = &a; int *ptr; ptr = (int*)ptr_to_a; cout<<(*ptr_to_a)<<" "<<ptr_to_a<<endl;; cout<<(a)<<" "<<&a<<endl;; cout<<*ptr<<" "<<ptr<<endl; // changing here. (*ptr) = 5; cout<<(*ptr_to_a)<<" "<<ptr_to_a<<endl;; cout<<(a)<<" "<<&a<<endl;; cout<<*ptr<<" "<<ptr<<endl; Output is 3 0x7ffe87e48554 3 0x7ffe87e48554 3 0x7ffe87e48554 5 0x7ffe87e48554 3 0x7ffe87e48554 5 0x7ffe87e48554 Can anyone explain why its giving output 3 while at same location im getting value 5.
Haziq
Hello,im new and i need a recommendation where to start learning C language Any recommendation like books,website or video?
Sabuhi
Thank you
You are welcome
Raveesha
#include <stdio.h> #include <string.h> #define SIZE 5 #define SIZE2 20 struct customer{ int account; char name[SIZE2]; char type; float amount; }customer[SIZE]; int main ( void ) { int indexNo , test1 = 0 , test2 = 0; float deposit = 0 , withdrawl = 0 , max , min; char maxName[SIZE2] , minName[SIZE2]; // max = -1; // min = 100000000; for( indexNo = 0; indexNo < SIZE; indexNo++ ) { printf ( "Enter your account number : " ); scanf ( "%d" , &customer[indexNo].account ); printf ( "Enter your name : " ); scanf ( "%s" , customer[indexNo].name ); printf ( "Enter your account type : " ); scanf ( "%*c%c" , &customer[indexNo].type ); printf ( "Enter your amount : " ); scanf ( "%f" , &customer[indexNo].amount ); if ( ( customer[indexNo].type == 'D' ) || ( customer[indexNo].type == 'd' )) { if ( test1 = 0 ) { max = customer[indexNo].amount; } deposit += customer[indexNo].amount; if ( max <= customer[indexNo].amount ) { max = customer[indexNo].amount; strcpy ( maxName , customer[indexNo].name ); } test1 = 2; } else if ( ( customer[indexNo].type == 'W' ) || ( customer[indexNo].type == 'w' )) { if ( test2 = 0 ) { min = customer[indexNo].amount; } withdrawl += customer[indexNo].amount; if ( min >= customer[indexNo].amount ) { min = customer[indexNo].amount; strcpy ( minName , customer[indexNo].name ); } test2 = 2; } printf ( "\n" ); } printf ( "Total deposit amount : %.2f\n" , deposit ); printf ( "Total withdrawl amount : %.2f\n" , withdrawl ); printf ( "Name of the customer with the maximum deposit amount : %s\n" , maxName ); printf ( "Name of the customer with the minimum withdrawl amount : %s\n" , minName ); return 0; }
Raveesha
theres error on withdrawl minimum amount can anyone check it?
Anonymous
guys help me
Anonymous
i dont know what do
Anonymous
Hello, i need help, why does my program isn't working I show you my source code
Anonymous
#include <cstdio> int main() { int search (int left, int right) { int mid = left; int res = 0; while (mid <= right) { if (mid % 11 == 0) { res++; mid++; } else if (mid % 12 == 0) { mid++; else { if (mid % 4 == 0) { res++; } mid++; } } return res; } }
Anonymous
With input (1, 100) Please help me 🥲
Anonymous
I am learning pointers and pointer variable can access data and manipulate data through deference operator * , if that is the case how secure is data in pointer environment! Any one can access data with no security!
Anonymous
I am learning pointers and pointer variable can access data and manipulate data through deference operator * , if that is the case how secure is data in pointer environment! Any one can access data with no security!
How will you obtain the pointer to the data in the first place without being provided access to the data (or maybe by a stupid programmer mistake where he returns a pointer or reference to data that is supposed to be encapsulated away)
Code WHIZ
Oh true!
you will learn oop there is a concept called encapsulation there you will get to know in detail.
AJAY
Explain with an example the passing of a structure to a function by reference.
Anonymous
Explain with an example the passing of a structure to a function by reference.
I think u can create ur own structure and pass name of structure as parameter in function call. But dont forget to put arguments in function pointing to a variable! I think it works
Sandeep
In cpp... The length function on a string is not the same as strlen on a char pointer...somebody explain this
Sandeep
In cpp... The length function on a string is not the same as strlen on a char pointer...somebody explain this
I observed that if I replace ith index with null character ...the length function still shows the same length