Anshul
Okay
Anonymous
hi
Lw
Thanks i hope i learn more and get advanced more 👍
Anonymous
Yes
Then just take the inputs in 2 std::vector<int or double>, compute the magnitude and the dot product. Divide the dot product by the product of the magnitudes of the 2 vectors. arccos of this result is the angle between the vectors
Bini
hey My name is Biniam. I am from Ethiopia. I want to be a programer please any suggestion
Anonymous
hello , everyone ,is there anyone who can help me with cyptopp++?
ببب ب
I was wondering, how could i implement my own tuple class, how's that commonly achieved by the C++ libraries?
Anonymous
I was wondering, how could i implement my own tuple class, how's that commonly achieved by the C++ libraries?
You need to be familiar with templates and template meta programming. Get the book C++ Templates (2nd edition). There is a chapter on how tuples and variants can be implemented
ninja
What is segmentation fault? And how can I fix this?
This happens when you trying to access data which is not allocated for your program
Hanz
I am getting segmentation fault during compiling cpp program
Provide your code in an online snippet sharing site, we do not know where is the error
Sandeep
I was asked to write a c++ program to mask data that is present in a database using any perturbation techniques...where do I begin
Anonymous
Is there anyone who can help me dld..
Puspam
Yes of course
Puspam
Anonymous
What help do you want?
Thanks bro i do it by my self.. thank you
Steve
Focus on the one which is being taught then go to the other one later.Its not advisable to do both.
shriman_deepak
int n ,count=0; cin>>n; while(n != 0) { n = n/10; ++count; } cout<<count; if (count == 3){ cout<<"the number is 3 digits."<< endl; }else{ cout<<"the number is not 3 digits"<<endl; }
shriman_deepak
You are given an N natural number. Decide whether N has 3 digits or not. Sample input/output:
shriman_deepak
#include<iostream> using namespace std; int main() { int num,Q; cout<<"Enter a number ="; cin>>num; Q=num/2; if (Q>=50||Q<=494) { cout<<"This is a three digit number"; } }
shriman_deepak
Pavel
to represent a number in some system what you need to do is just divide it by the base in a loop, find a reminder on each step, and that reminder will be the digit (from right to left). Converting back is essentially multiplication with addition Here's some math behind it https://www.tutorialspoint.com/computer_logical_organization/number_system_conversion.htm
Anonymous
Which is code is most appropriate for this following question.
Neither. Your second method is wrong as well. Can't you just do this: if((n >= 100) && (n <= 999)) cout << "Three digit number";
Vikas
https://codeforces.com/problemset/problem/750/A How to solve this using binary search?
Adams Scott
Hi Please i need a mentor to guide me and teach me c language 🥺🥺
shriman_deepak
Yeah
Can you please explain?
Captain
Can you please explain?
Say n = 103 If you divide it by 10 the n becomes 10 And again divide by 10 It becomes 1 Finally when u do 1/10 it will become zero And while loop exits And count becomes 3 The program will give exact numbers of digits in a number
Captain
Can you please explain?
Have a habit of using debugger it helps to find bug, how the program executes and in many other ways
ꠋꠋꠋ ☬ ]ᯱꠋꠋꠋꠋꠋꠋꠋꠋꠋꠋꠋꠋꠋꠋ ⨳ࣩࣩࣩࣩࣩࣩࣩࣩࣩࣩࣩࣩࣩࣩࣩࣩࣩࣩࣩࣩࣩࣩࣩࣩࣩࣩࣩࣩࣩࣩࣩࣩࣩࣩࣩࣩࣩࣩࣩࣩ
how can i delete folder in c++? pleas...
Anonymous
how can i delete folder in c++? pleas...
Check out remove and remove_all in std::filesystem
Anonymous
Anyone??
Search for encryption techniques in C++.
Sandeep
Search for encryption techniques in C++.
Yes the results are showing how to encrypt and decrypt..but..what I need to do is connect mysql to visual studio and then write code that masks any data not required by the user when he resqests a query.. I did the connection part.. But I don't know how to write the code in it
Anonymous
Yes the results are showing how to encrypt and decrypt..but..what I need to do is connect mysql to visual studio and then write code that masks any data not required by the user when he resqests a query.. I did the connection part.. But I don't know how to write the code in it
Once you have the connection, how difficult can it be retrieve a query resultset from the DB? I don't understand why you need to mask data not requested by the user. Won't not returning the fields not requested by the user suffice. For ex - Select e.id, e.name from employee as e where e.id = 1000 You don't need to return address, age etc for this query. Why mask them?
Anonymous
I know what data masking is and what it is used for. In the link that you have shown masking is used at the DB level where the data itself is stored after masking it. But your question was different and you said that you wanted to "mask fields not requested by the user". What better masking can there be than not fetching the data itself.
Sandeep
I know what data masking is and what it is used for. In the link that you have shown masking is used at the DB level where the data itself is stored after masking it. But your question was different and you said that you wanted to "mask fields not requested by the user". What better masking can there be than not fetching the data itself.
Sorry I must have understood the question wrong.. this is the exact question.. Write a C++ or Java Program to mask the data use any of your interested perturbation techniques Note: the codehas to to connect to database and fill the entries with masked values.
Anonymous
If I change the data in the DB can I revert?
If you encrypt it and have the encryption key (per record) stored somewhere then yes you can decrypt it as well
Sandeep
If you encrypt it and have the encryption key (per record) stored somewhere then yes you can decrypt it as well
So after encrypting ..if someone requests the data he can't see anything no..that means I should decrypt that part and show it to him?
Anonymous
So after encrypting ..if someone requests the data he can't see anything no..that means I should decrypt that part and show it to him?
Yes. If you are going to show the details there is no point in encryption. The whole point of encryption is to hide sensitive data like PII (Personally Identifiable Information) from others. Only in cases, where you determine a valid use, should you decrypt them. For ex - it is ok to show a user's phone and address when the user logs into your web portal. It is not ok to show it when a support technician tries to access the user's details. So in the former case, you will decrypt it and in the latter case you won't. But I doubt this is what the person who asked you this question is interested in. He probably wants you to just mask sensistive data on fetching the results. They will most likely be stored in clear text form in the database.
Sandeep
Now how do I do that
Anonymous
Okay the second one it is
Learn about how you retrieve a result set from a user query. Learn about prepared or managed SQL statements. Once you have fetched the result set, just mask the sensistive fields by replacing the individual characters with X leaving out the first few or the last few characters. Display only this masked result.
Anonymous
Learn about how you retrieve a result set from a user query. Learn about prepared or managed SQL statements. Once you have fetched the result set, just mask the sensistive fields by replacing the individual characters with X leaving out the first few or the last few characters. Display only this masked result.
The easiest way to do this however would be to use the MySQL mask functions itself. When you create a PreparedSQL statement, you can ensure that it requests for Masked details by calling the mask* functions. The fetched ResultSet will have all the entries masked by the DB itself.
Sandeep
???
Should I mask it while creating
Anonymous
Should I mask it while creating
No. You create a view that masks the data. Whenever you are asked to retireve data from a table, you fetch data from that view instead. So here the DB masks the data. The data stored in the DB is in clear text form, but the ones fetched through the view will be in masked form. I have already suggested 3 options for you. Read about them and see which one is applicable for yout use case
Janvi
#include <stdio.h> #include <string.h> struct student { char name [50]; int jeerank; // <50,000 int aadharnumber; float percent10; // >60 float percent12; // >50 char stream[10]={"cse"}; }; student Admission_Bit[99999]; int verify(student abc) { if(abc.jeerank<50000 && (int)abc.percent10>60 && (int)abc.percent12>50) { return 1; } return 0; } int payment() { int ans; printf("Did you Paid your Admission Fee of Rs 70,000 ?\n"); printf("Enter 1 for YES 0 for NO: \t"); scanf("%d",&ans); return ans; } int cse=0,ece=0,it=0,bt=0; void count(student *abc) { int k=0 printf("\n Enter your stream"); printf("\n1 for CSE\n2for ECE \n3 for IT \n 4 for BT"); printf("\nenter your choice"); scanf("%d,&k"); switch(k) { case 1: cse++; strcpy(a,stream,"CSE"); break; case 2: ece++; strcpy(a,stream,"ECE"); break; case 3: it++; strcpy(a.stream, "IT"); break; case 4: bt++; strcpy(a.stream, "BT"); break; default:cse++; } } int main() { int i,x, n, total=0; printf("\nEnter number of students."); printf("\nEnter your NAME: "); scanf("%s",&51.name); printf("\nEnter your JEE RANK: "); scanf("%d", &$1.jee_rank); printf("\nEnter your ADHAAR NUMBER: "); scanf("%d",&s1.adhaar); printf("\nEnter your 10th percentage: "); scanf("%f",&s1.per10); printf("\nEnter your 12th percentage: "); scanf("%f",&s1.per12); x=verify(81); if(x==1) { x=payment(); } if (x==1) { count(51); admission_bit[total]=s1; total++; } } printf("\nStudents Enrolled\n\n\nStream\tStudent's Name\n"); for(i=0; i<total; i++) { printf("%s\t%s", admission_bit[i].stream, admission_bit[i].name); } printf("\nCSE = %d", cse); printf("\nECE = %d", ece); printf("\nIT = %d", it); printf("\nBT = %d", bt); return 0;
Janvi
find bugs in this program this is not running properly after trying a lot still
Anonymous
Can any one help me in code
Anonymous
I have one que
Prince kumar
Yeah send
Anonymous
Hi
Anonymous
Hello
I
https://practice.geeksforgeeks.org/problems/minimize-the-heights3351/1
I
https://practice.geeksforgeeks.org/problems/minimize-the-heights3351/1
Can anyone help me in this... I am not getting why for this problem i need to sort the array first and after that how comparison is done for finding smallest and largest tower ..
I
class Solution { int getMinDiff(int[] arr, int n, int k) { int min=0,max=0,r=0; Arrays.sort(arr); r=arr[n-1]-arr[0]; for(int i=1;i<n;i++) { if(arr[i]>=k) { max=Math.max(arr[i-1]+k,arr[n-1]-k); min=Math.min(arr[i]-k,arr[0]+k); r=Math.min(r,max-min); } else { continue; } } return r; }}
Anonymous
https://wandbox.org/permlink/oCI9n8XFUwCmZ7C1 how do i correctly scale my offset? the main code is in View.cpp calc
Janvi
Do anyone here know C programming well?
Anonymous
virtual viewport : {0, 0, 100, 100} draw dimensions : {100, 100} virtual offset : {20, 20} virtual_canvas_draw_position : {20, 20, 120, 120} virtual_canvas_draw_position percentage : {0.2, 0.2, 1.2, 1.2} required virtual size : {20, 20} resulting draw position : {20, 20, 20, 20} size : {200, 200} relative position : {40, 40, 40, 40} relative percentage : {0.2, 0.2, 0.2, 0.2} prog.exe: prog.cc:118: int main(): Assertion `a.relativePosition == Rectangle(20, 20, 40*2, 40*2)' failed.
Janvi
Can anyone help me with a C programming
Anshul
priority_queue <int, vector<int>, greater<int>> g = gq;
Anshul
in this why the vector is passed to the queue P.S. *priority_queue
Anshul
While using heap STL why we have to pass a vector of the type of heap. Why we can't just pass the type of heap and the class to compare
Anshul
Like we do in set STL. we just pass the type of set and the class how to sort the elements
Anonymous
While using heap STL why we have to pass a vector of the type of heap. Why we can't just pass the type of heap and the class to compare
Because the 2nd template parameter is the underlying data structure. A priority queue is just an adaptor which means it is a facade on top of another container like a deque or a vector and makes this underlying container act like a priority queue. The standard gives you the option of specifying this container type as the 2nd template argument. It is the same for stack and queue as well which are also adaptor conntainers
Anonymous
I still can't understand the need to 2nd parameter. Why not give just 1st and 3rd parameter?
Because some people will want to choose a different underlying container.
Anonymous
They could have made the underlying container the 3rd template argument instead of the 2nd butdue to an oversight it remained the 2nd argument. So everytime you want to specify a comparison operator, you must unfortunately supply the underlying container type as well.