Anonymous
virtual ~ParticleSpecies() = default; I did this, it got rid of the warning message but I have no idea if it solves the issue the compiler is trying to warn me about. Just followed this.
The reason why you need a virtual destructor is because if you destroy a Derived class object using a Base class pointer (by using delete expression) it will result in Undefined Behavior. Now using =default for the virtual destructor depends on your class. If you have nothing special to do in the destructor then the default destructor provided by the compiler should suffice
Mariam
#include <iostream> using namespace std; int main() { int t; cin >> t; long long s, a, b, c; while (t--) { cin >> s >> a >> b >> c; } int p = (s - a * c) / c; while(t- -){ { cout << p + a + (a * b); } } return 0; }
Mariam
Hello can you tell me How do I not fall into its endless cycle??
the best for everyone
can anyone tell me how to make the logic of time to check seconds and minute and hours
Kriss
Anybody done that HRML markup language challenge on hackerarank ? If yes that can u give me a hint or something
Anonymous
Yep sure. If you still face issues let me know i will share small example to read xml file.. 👍🏻
I'm not getting the code. Kindly share code to read XML file in c
Light
#include <stdio.h> int fun(char *x, char *y){ char player; player = x; printf("%s\n", player); return 0; } int main(){ char x[20] = "X"; char y[20] = "Y"; fun(&x, &y); return 0; } How can I assassin x value to player?
Light
I want to save *x and *y value to player so that I can use work with them
klimi
I want to save *x and *y value to player so that I can use work with them
well you need some datastructure to hold both of them then, like a struct with 2 chars pointers
dipan
#include<stdio.h> void main() { int matrix1[10][10],i,j,m,n; printf("enter the row and column of matrix1"); scanf("%d%d",&m,&n); for(i=0;i<m;i++) { for(j=0;j<n;j++) { scanf("%d",&matrix1[i][j]); } } for(i=0;i<m;i++) { for(j=0;j<n;j++) { printf("%d\t",matrix[i][j]); } printf("\n"); } }
dipan
i was trying to display matrix of row column m*n it didnot worked
dipan
anyone plz correct this
Safwan
What's the error showing?
Jemin
#include<stdio.h> void main() { int matrix1[10][10],i,j,m,n; printf("enter the row and column of matrix1"); scanf("%d%d",&m,&n); for(i=0;i<m;i++) { for(j=0;j<n;j++) { scanf("%d",&matrix1[i][j]); } } for(i=0;i<m;i++) { for(j=0;j<n;j++) { printf("%d\t",matrix1[i][j]); } printf("\n"); } }
dipan
Ok thanks bro
dipan
1 was missing there
Anonymous
@Habibi_158 , Jemin Stick to English. Read the rules.
ʟᴏɴᴇᴡᴏʟꜰ
What are some good resources for learning c++ ?
ʟᴏɴᴇᴡᴏʟꜰ
Any book, tutorial or videos
ʟᴏɴᴇᴡᴏʟꜰ
Safwan
@Habibi_158 , Jemin Stick to English. Read the rules.
Sorry i thought he might understand English better that's why
Anonymous
I'm not getting the code. Kindly share code to read XML file in c
Yes i will share it tomorrow. Was busy today..👍🏻
Saint Paul
Hi every I'm trying to set Region of Interest with PLC but it doesn't work for me . Any idea please ?
Dinuka
Hi, i have non related to C programming question. (-9)*(-11) Convert these 2 decimal numbers into binary and multipy. When i try to solve this. Always getting wrong answer. Any body can help me to solve this?
Dinuka
How looks your converting function?
Seems like i do it wrong. 1st i convert to binary and get two's complement. But both negative numbers, so i do not need to get two's complement right?
Дон
Seems like i do it wrong. 1st i convert to binary and get two's complement. But both negative numbers, so i do not need to get two's complement right?
Iirc you can compute the result of multiplication and then convert it into binary. Sample: (-9)*(-11) = 99 --> convert 99 into binary
ɛ n h ᴀ n c ɛ ґ 🧟‍♂️
pastebin.com/3h7inWnq If anyone could go through this code and and tell me which part I’ve made an error I’ll be very glad (it’s about displaying content of a linked list) Compiler doesn’t show any error but the values are not being displayed
Philklin
Please I'm new in C++ programming Someone should lecture me please 🙏
Captain
pastebin.com/3h7inWnq If anyone could go through this code and and tell me which part I’ve made an error I’ll be very glad (it’s about displaying content of a linked list) Compiler doesn’t show any error but the values are not being displayed
Your append function logic is wrong, you should reach to end and then you should add the next node as newNode. append function: While(ptr->next) ptr = ptr->next; While ends Ptr->next = newNode
Captain
Also for display function you should check if ptr becomes null in while condition which will print all elements
Oda Waves
Hey guys i am trying to open falsh file on internet but when i used ruffle it gives me that message (This content contains ActionScript 3 which not yet supported by Ruffle emulator) , do you know any application , i can use Note : adobe not working anymore from 31 Dec 2020
Anonymous
Write a program in C to find the square of any number using the function
Kriss
#include <iostream> int main(){ int ages[5]; for(int i =0 ; i < 5 ; i++ ){ std::cin >> ages[i] ; } int size = sizeof(ages)/sizeof(int); float total = size * 10 ; for(int j =0 ; j >5 ; j++){ int min = ages[i]; if ( min < ages[j+1]){ min = ages[j +1]; } else { min = ages[j]; } } std::cout << min; -----end------ In the above code I want to print the value of _min_ variable which is in for loop but I cannot as it is out of scope and if I declare the variable outside ,it prints the value which is not affected by for loop
Kriss
*ages[j]
Anonymous
Yes i will share it tomorrow. Was busy today..👍🏻
Kindly share the code for reading XML file in c programming language
Captain
https://pastebin.com/Jqx7E6c0 Bro i updated it but this time it prints just 1 element
The assignment of newNode to next node of ptr should be done after the while loop ends
Clash
bool mycmp(pair<int,int> a,pair<int,int> b) { return a.second<b.second; } int activitySelection(vector<int> start, vector<int> end, int n) { int res=1; vector<pair<int,int>> arr; for(int i=0;i<start.size();i++) { arr[i].first=start[i]; arr[i].second=end[i]; } sort(arr.begin(),arr.end(),mycmp); int prev=0; for(int curr=1;curr<n;curr++) { if(arr[curr].first>arr[prev].second) { res++; prev=curr; } } return res; } }; in this code that mycmp function is not working
Kriss
*ages[j]
Are u pointing out ages[i]?
Дон
.
j > 5? Maybe j < 5? And check this line: int min = ages[i]; //i - local variable for first loop, didn't exist
Kriss
j > 5? Maybe j < 5? And check this line: int min = ages[i]; //i - local variable for first loop, didn't exist
Ohkay , I fixed that but still how I print the modified value of min from second loop
Дон
Ohkay , I fixed that but still how I print the modified value of min from second loop
define your min variable before for-loop (int min = ages[0];) and you don't need the else branche/total variable/size variable. also your if-brance not correct, do: if (min > ages[j]) min = ages[j];
Дон
Thanks for the help , I willl do that ,
The things kinda this better to check debug to see how they works. And I wanna recommend you - #res
Kriss
The things kinda this better to check debug to see how they works. And I wanna recommend you - #res
Yeah, I am starting with the book c++ primer from #res, thanks again
artemetra 🇺🇦
nooby question about C suppose i have this struct: typedef struct A { uint8_t some_array[6]; uint8_t some_int; } A; and suppose i have a pointer to it, say A_ptr when accessing some_array through the -> operator (A_ptr->some_array), do i get the pointer to the array? and when accessing some_int the same way, is it the pointer to the int or the value itself?
artemetra 🇺🇦
i guess the array decays into a pointer but i'm not that familiar with that (i mostly used C++ before)
pavel
The same as in c++
pavel
Some array - pointer, some int - value
Pavel
nooby question about C suppose i have this struct: typedef struct A { uint8_t some_array[6]; uint8_t some_int; } A; and suppose i have a pointer to it, say A_ptr when accessing some_array through the -> operator (A_ptr->some_array), do i get the pointer to the array? and when accessing some_int the same way, is it the pointer to the int or the value itself?
I'm not a C programmer, just decided to test it. It seems like you get pointer as soon as you assign it to something (note the warning), but just the result of that expression seem to be an array (note the sizeof) https://wandbox.org/permlink/gDyEuJjL5y2NTmsN
artemetra 🇺🇦
inspiroman
those who says they are good coders of any language dm me.
тнє ρяσgяαммєя 👨‍💻
Write a program in C to find the square of any number using the function
int ft_sqrt(int nb) { int i; i = 1; if (nb <= 0) return (0); while (i < 46342) { if (i * i == nb) return (i); i++; } return (0); }
Kriss
Int x= 17; double y = 1/x; std::cout << y; Why y is zero?
Pavel
Int x= 17; double y = 1/x; std::cout << y; Why y is zero?
Integer division first, only then result converted to double
Pavel
So how I fixed it?
double y = 1.0/x;
Дон
Anonymous
Good morning Team
Anonymous
Past 4 days
Anonymous
I'm looking for how to read XML file in c programming language
Anonymous
Kindly anyone share code for that
Anonymous
Does anyone have a qt group?