8 Discussion / Question Topics
Remove Filter I am implementing RSA in C++ and here's my design(code structure). *keygen.h* namespace rsa{ class keygen{ public: //Constructor keygen(size); //Generate keys void generate(); //Getters string gete(){ return xyz; } .. .. .. private: //initializes bignums void initall(); keygen(){} //Private Member variables goes here } } *prime.h* namespace rsa{ //First 100 … | |
I need to write a program, which prints out all the prime numbers between two numbers. The first input specifies the number of test cases, followed by the limits. Here is an example.. [QUOTE] Input: 2 1 10 3 5 Output: 2 3 5 7 3 5 [/QUOTE] I wrote … | |
I wrote a program which finds the next palindrome. First, it takes an input specifying the number of test cases. The code runs fine in Visual C++, but am not able to run it in GCC. I have never used GCC before so unaware with its functioning. But am expecting … | |
I'm a lot confused with multi-dimensional arrays and pointers. I tried searching, found and read some articles. But there are still some doubts. We can not use a double pointer(int **) for a two dimensional array, right? Instead we need to have an array of pointers with the length equal … | |
Question by ~s.o.s~ Write a program which will perform the job of moving the file from one location to another. The source and destination path will be entered by the user. Perform the required error checking and handle the exceptions accordingly. (Intermediate) [code=c++]#include<fstream> #include<iostream> #include<cstdio> using namespace std; int main(){ … | |
Practise problem by ~s.o.s~ Q. Write a program which performs addition, subtraction, multiplication of matrices. The dimensions of both the matrices would be specified by the user (dynamic memory allocation required). Use of structure or a class to define the matrix would be a good idea. (Expert) [CODE]#include<iostream> using namespace … | |
[URL="http://www.daniweb.com/forums/post303743-1.html"]Q.Write a program which will print all the pairs of prime numbers whose sum equals the number entered by the user. ( suggested by Aniseed ) (Intermediate) [/URL] [code=C++] #include<iostream.h> #include<conio.h> #include<math.h> int prime(int); void main() { int i,j,c1,c2,num,f1,f2; clrscr(); cout<<"Enter the number-"; cin>>num; for(i=2,j=num-2;i<=num/2;i++,j--) { f1=prime(i); if(f1) { f2=prime(j); … | |
This is strstr() function made by me as given in the practice problem. [code=c++] char *cstrstr(char s[],char ss[]) { int l1,l2,i,j,k,flag=0; char *p=NULL; l1=strlen(s); l2=strlen(ss); for(i=0;i<l1;i++) { //cout<<"i:"<<i; p=&s[i]; if(ss[0]==s[i]) { for(k=i,j=0;j<l2;j++,k++) { //cout<<"j:"<<j<<"k:"<<k; if(ss[j]==s[k]) { flag=1; continue; } else { flag=0; break; } } } if(flag) return p; } … |
The End.