Anonymous
hey 🙋🏼‍♀️😋 Can anyone help me about my exam?
Anonymous
If you want to help me. You can contact with me on DM!🥺🙏🏻
Anshul
Anonymous
okay but i cant share picture on here
klimi
okay but i cant share picture on here
exactly, if you want to share a code, use some code sharing service like pastebin
Anonymous
First question Write a C program that performs the required actions on the array of pointers (dynamically allocated double pointers, or dynamically allocated matrix). Each item is integer type and may store 1 or 0. Your program must have the following functionality: a. Upsert (insert new if not exists or update existing) 1 for the given index. If the given row does not exist, program must create the row first. All items from zero index to col index must be assigned to 0. Upsert must support random access. e.g. upserting into a row 2, program must create row 1 with 0. Upsert must expand the given row by the required number of items, if required. (Hint: reallocting array space with the new array size, and transferring the existing array items to the new array) Return items in the given column as an array.
Anshul
You should go and read the pinned message once. Asking complete questions here isn't allowed. You can ask some part where you are stucked
Anonymous
@ractico this person assaulting me with DM
klimi
@ractico this person assaulting me with DM
¯\_(ツ)_/¯ you asked for them
MᏫᎻᎯᎷᎷᎬᎠ
The Committee is working under 23 standard hahah I'm really amazed of how fast the time went
MᏫᎻᎯᎷᎷᎬᎠ
There are already some features approved
Hermann
how serialize my object?
Pavel
how serialize my object?
I'm not an expert in this topic but for what I know, it depends, there are many ways, starting with manual serialization from a member function to using some complex stuff like protobuf. You can have a look at boost::serialization, if using boost is fine. I heard of some people who used llvm to generate serialization/deserialization code. For some of my components I use python to generate C++ code of serialization/deserialization. Also you can have a look at visitor pattern that sometimes used for serialization. And one thing that have bitten me a couple of times: if you serialize data that can be used by newer versions of your application, think about how you going to upgrade your serialized data in advance (some formats are very bad at that).
Anonymous
I need help
Abo
Hello my friends, who has a solution to this problem, I try to put BIO, but when he pastes it, black boxes appear like this. Use C# Library sileneom
佳辉
#include <stdio.h> float add(float num1, float num2) { return num1+num2; } float sub(float num1, float num2) { return num1-num2; } float mult(float num1, float num2) { return num1*num2; } float div(float num1, float num2) { return num1/num2; } int main() { float num1,num2,result; char choice; do { printf("1.Addition\n"); printf("2.Subtraction\n"); printf("3.Multiplication\n"); printf("4.Division\n"); printf("5.Exit\n\n"); printf("Enter Your Choice : "); scanf("%d",&choice); switch(choice) { case 1: printf("Enter first number : "); scanf("%f",&num1); printf("Enter second number : "); scanf("%f",&num2); result = add(num1,num2); printf("Result:%f",result); break; case 2: printf("Enter first number : "); scanf("%f",&num1); printf("Enter second number : "); scanf("%f",&num2); result = sub(num1,num2); printf("Result:%f",result); break; case 3: printf("Enter first number : "); scanf("%f",&num1); printf("Enter second number : "); scanf("%f",&num2); result = mult(num1,num2); printf("Result:%f",result); break; case 4: printf("Enter first number : "); scanf("%f",&num1); printf("Enter second number : "); scanf("%f",&num2); result = div(num1,num2); printf("Result:%f",result); break; case 5: return 0; break; default : printf("Wrong Choice..!!"); break; } printf("\n------------------------------------\n"); } while(choice<=5); }
佳辉
this is my coding for simple calculator
佳辉
Step 1:Start Step 2:Take two numbers as input and store them in the variables num1 and num2 Step 3:Take input to let the user choose the operation that needs to be performed. Step 4:If the user chooses addition, then perform num1+num2. Step 5:If the user chooses subtraction, then perform num1-num2. Step 6:If the user chooses multiplication, then perform num1*num2. Step 7:If the user chooses division, then perform num1/num2. Step 8:Print the value after carrying out the operation according to the user's choice. Step 9:End
Anonymous
Thanks 😊
Anonymous
I'm so happy to join you guys ☺️
佳辉
Rajputana
How to print this series in c. 1 1 2 1 1 2 3 2 1 1 2 3 4 3 2 1 Please explain the simplest logic using loops. and how to approach these kind of questions My problem with this question is that the logic doesn't strike.
Anonymous
wait what
Have you executed this?
Loner〽💻
How to print this series in c. 1 1 2 1 1 2 3 2 1 1 2 3 4 3 2 1 Please explain the simplest logic using loops. and how to approach these kind of questions My problem with this question is that the logic doesn't strike.
int n=1; for(int i=6;i>=0;i--) { for(int j=0;j<i;j++) cout<<" "; for(int j=1;j<n+1;j++) cout<<j<<" "; for(int j=n-1;j>0;j--) cout<<j<<" "; n++; cout<<endl; }
Loner〽💻
try that👆
Talula
How to print this series in c. 1 1 2 1 1 2 3 2 1 1 2 3 4 3 2 1 Please explain the simplest logic using loops. and how to approach these kind of questions My problem with this question is that the logic doesn't strike.
#include <stdio.h> int main() { for (int i = 1; i <= 4 ; i++) { for (int y = 1; y <= (4-i); y++) printf(" "); for (int x = i; x >= 1; x--) { printf(" "); printf("%d",x); printf(" "); } for (int x = 1; x <= i; x++) { if (x != 1) { printf(" "); printf("%d",x); printf(" "); } } printf("\r\n"); } }
Anshul
Anyone have coding blocks courses?
Anonymous
Output is not like that.... As he sent
Talula
Tanaaaz, there is some mistake...
#include <stdio.h> int main() { for (int i = 1; i <= 4 ; i++) { for (int y = 1; y <= (4-i); y++) printf(" "); for (int x = 1; x <= i; x++) { printf(" "); printf("%d",x); printf(" "); } for (int x = i; x >= 1; x--) { if (x != i) { printf(" "); printf("%d",x); printf(" "); } } printf("\r\n"); } }
Talula
Updated...
Rberto
#include <stdio.h> float add(float num1, float num2) { return num1+num2; } float sub(float num1, float num2) { return num1-num2; } float mult(float num1, float num2) { return num1*num2; } float div(float num1, float num2) { return num1/num2; } int main() { float num1,num2,result; char choice; do { printf("1.Addition\n"); printf("2.Subtraction\n"); printf("3.Multiplication\n"); printf("4.Division\n"); printf("5.Exit\n\n"); printf("Enter Your Choice : "); scanf("%d",&choice); switch(choice) { case 1: printf("Enter first number : "); scanf("%f",&num1); printf("Enter second number : "); scanf("%f",&num2); result = add(num1,num2); printf("Result:%f",result); break; case 2: printf("Enter first number : "); scanf("%f",&num1); printf("Enter second number : "); scanf("%f",&num2); result = sub(num1,num2); printf("Result:%f",result); break; case 3: printf("Enter first number : "); scanf("%f",&num1); printf("Enter second number : "); scanf("%f",&num2); result = mult(num1,num2); printf("Result:%f",result); break; case 4: printf("Enter first number : "); scanf("%f",&num1); printf("Enter second number : "); scanf("%f",&num2); result = div(num1,num2); printf("Result:%f",result); break; case 5: return 0; break; default : printf("Wrong Choice..!!"); break; } printf("\n------------------------------------\n"); } while(choice<=5); }
What's happen if choice > 5? the do while loop finish, instead of do another iteration...
Rberto
wait what
He said that will test your calculator :D
Rberto
so how was my algorithm
In the line: while(choice <= 5) I recommend you change the conditional with: (choice != 5)
Talula
What is the difference actually?
No difference... actually choice <= 5 is better way to do it as it will make sure in case you're stepping 2 times it'll work.
Rberto
What is the difference actually?
if you write: do { ... scanf("%d",&var); ... } while ( var <= 5); And you enter 6 "in example", that will end the loop. Because 6 > 5 , that make the conditional's loop (choice <= 5) will be false and break the loop.
佳辉
yup
Inside algorithm not need write about switch case,function and do while?
Anonymous
Is there any Chinese or Koreans?
Talula
Anonymous
Wow...👏👏.... Really She is brilliant....
Rberto
Inside algorithm not need write about switch case,function and do while?
You could like to add something like: int read(int numbers[]); int main() { float numbers[2]; ... switch(choice) { case1: read(numbers); result = add(numbers); printf(result); case2: read(numbers); result = sub(numbers); printf(result); } } int read (int numbers[]) { // Read two numbers & add to an array for (int i = 0; i < 2; i++) { // Free up the array numbers[i] = 0; } printf("Enter first number: "); scanf("%f", numbers[0]); printf("Enter second number: "); scanf("%f", numbers[1]); }
Rajputana
It looks like I need more brain workout 😂
Rberto
wait,add inside algorithm?
nou... it requires to change some parts of your code.
Hermann
how copy string to vector<string>?
Hermann
how copy string to vector<string>?
std::copy( tmp_string.begin(), tmp_string.end(), back_inserter(tmp_pkt_list) ); not work
Pavel
lol ... thanks
By the way, your code tried to push each symbol as a new element of the vector (that probably would work for vector<char>)
Official hooligan of Pius XII
Do you have any off-topic channel? I don't want to spam but I don't see any info in the pinned message which kinda surprises me
Rberto
@admin which is the off-topic group?
Njabu
Evening guys, please help me here, Im good in Data structures, not Arrays! #define N 100 #include<iostream> #include<stdio.h> using namespace std; class merge_Array { public: void Merge(int array1[N], int array2[N], int array3[N], int n1, int n2) { int i = 0, j = 0, k = 0; while (i < n1 && j < n2) { if (array1[i] < array2[j]) { array3[k++] = array1[i++]; } else { array3[k++] = array2[j++]; } } while (i < n1) { array3[k++] = array1[i++]; } while (j < n2) { array3[k++] = array2[j++]; } } }; int main() { merge_Array ma; int n1, n2, n3; int i; int A[N], B[N], C[N]; cout << "Enter the size of First array:\n"; cin >> n1; cout << "\nEnter the elements of First array:\n"; for (i = 0; i < n1; i++) cin >> A[i]; cout << "\nEnter the size of Second array:\n"; cin >> n2; cout << "\nEnter the elements of Second array:\n"; for (i = 0; i < n2; i++) cin >> B[i]; sort(A, A + n1); sort(B, B + n2); //cout << "\nElements of First sorted array:\n"; for (i = 0; i < n1; i++) cout << A[i] << " "; //cout << "\nElements of Second sorted array:\n"; for (i = 0; i < n2; i++) { cout << B[i] << " "; } ma.Merge(A, B, C, n1, n2); cout << "\nElements after Merging Arrays:\n"; for (i = 0; i < (n1 + n2); i++) { cout << C[i] << " "; } return 0; }
Njabu
Sort(A,A)