Problem in returning the used defined data type using structure
-
hi everyone.. I have written a program where I want to return three user defined data types to the another main() function (here i have not mentioned that main). I want to return {Pa,c1,c2} from this program. Please help me out.
#include <cstdlib>
#include <iostream>
#include <vector>
using std:: cout;
using std:: cin;
using std:: endl;
using namespace std;
#include <math.h>
#include "FiniteFieldElement.hpp"namespace Cryptography
{
template<int P>
class EllipticCurve
{
public:typedef FiniteFieldElement<P> ffe\_t; class Point { friend class EllipticCurve<P>; typedef FiniteFieldElement<P> ffe\_t; ffe\_t x\_; ffe\_t y\_; EllipticCurve \*ec\_; void addDouble(int m, Point& acc) { if ( m > 0 ) { Point r = acc; for ( int n=0; n < m; ++n ) { r += r; // doubling step } acc = r; } } Point scalarMultiply(int k, const Point& a) { Point acc = a; Point res = Point(0,0,\*ec\_); int i = 0, j = 0; int b = k; while( b ) { if ( b & 1 ) { addDouble(i-j,acc); res += acc; j = i; } b >>= 1; ++i; } return res; } void add(ffe\_t x1, ffe\_t y1, ffe\_t x2, ffe\_t y2, ffe\_t & xR, ffe\_t & yR) const { if ( x1 == 0 && y
-
hi everyone.. I have written a program where I want to return three user defined data types to the another main() function (here i have not mentioned that main). I want to return {Pa,c1,c2} from this program. Please help me out.
#include <cstdlib>
#include <iostream>
#include <vector>
using std:: cout;
using std:: cin;
using std:: endl;
using namespace std;
#include <math.h>
#include "FiniteFieldElement.hpp"namespace Cryptography
{
template<int P>
class EllipticCurve
{
public:typedef FiniteFieldElement<P> ffe\_t; class Point { friend class EllipticCurve<P>; typedef FiniteFieldElement<P> ffe\_t; ffe\_t x\_; ffe\_t y\_; EllipticCurve \*ec\_; void addDouble(int m, Point& acc) { if ( m > 0 ) { Point r = acc; for ( int n=0; n < m; ++n ) { r += r; // doubling step } acc = r; } } Point scalarMultiply(int k, const Point& a) { Point acc = a; Point res = Point(0,0,\*ec\_); int i = 0, j = 0; int b = k; while( b ) { if ( b & 1 ) { addDouble(i-j,acc); res += acc; j = i; } b >>= 1; ++i; } return res; } void add(ffe\_t x1, ffe\_t y1, ffe\_t x2, ffe\_t y2, ffe\_t & xR, ffe\_t & yR) const { if ( x1 == 0 && y
-
Return it to where, and where and what are these variables? Please also delete your duplicate of this post.
Use the best guess
Both threads are copies from here