Click here to Skip to main content
13,089,433 members (59,309 online)
Rate this:
Please Sign up or sign in to vote.
See more:
Hi. I wrote a simple program for creating and editing vector. I need the graphic user interface to it. I do not know how. The most primitive. Help me, someone.

#include <conio.h>
#include <iostream.h>
class vect {
   vect operator+(const vect &) const;   
   vect operator-(const vect &) const;
   vect operator*(const vect &); 
   vect operator*(const int &); 
   void print() const;
   int a,b,c,d,e;
vect::vect(int a1,int b1,int c1,int d1,int e1)
   a = a1;
   b = b1;
   c = c1;
   d = d1;
   e = e1;
vect vect::operator+(const vect &operand2) const
   vect sum;
   sum.a = a + operand2.a;
   sum.b = b + operand2.b;
   sum.c = c + operand2.c;
   sum.d = d + operand2.d;
   sum.e = e + operand2.e;
   return sum;
vect vect::operator-(const vect &operand2) const
   vect diff;
   diff.a = a - operand2.a;
   diff.b = b - operand2.b;
   diff.c = c - operand2.c;
   diff.d = d - operand2.d;
   diff.e = e - operand2.e;
   return diff;
vect vect::operator*(const vect &operand2)
   vect proizv;
   proizv.a = a * operand2.a;
   proizv.b = b * operand2.b;
   proizv.c = c * operand2.c;
   proizv.d = d * operand2.d;
   proizv.e = e * operand2.e;
   return proizv;
vect vect::operator*(const int &operand2)
   vect proizv;
   proizv.a = a * operand2;
   proizv.b = b * operand2;
   proizv.c = c * operand2;
   proizv.d = d * operand2;
   proizv.e = e * operand2;
   return proizv;
void vect::print() const
   cout<<'('<<a<<", "<<b<<", "<<c<<", "<<d<<", "<<e<<')';
int main(int argc, char* argv[])
   vect x(5,6,7,8,9),y(4,3,2,1,7);
   vect z;
   int scl = 8;
   cout<<"\n Vector 1:   ";
   cout<<"\n Vector 2:   ";
   z = x + y;
   cout<<"\n Slozhenie:   ";
   z = x - y;
   cout<<"\n Vichitanie:  ";
   z = x * y;
   cout<<"\n Vector*Vector:   ";
   z = x * scl;
   cout<<"\n Scalar1:   ";
   z = y * scl;
   cout<<"\n Scalar2:   ";
   return 0;
Posted 6-Sep-10 8:10am
Updated 7-Sep-10 0:26am
Toli Cuturicu 6-Sep-10 16:08pm
Reason for my vote of 2
Code is not C#, Tags is C#...
cccfff777 9-Sep-10 5:07am
The tag IS c++/gui
Rate this: bad
Please Sign up or sign in to vote.

Solution 3

In this case, how to make the input of these two vectors? In my code vectors are set by default.
Richard MacCutchan 8-Sep-10 9:35am
See my answer to your other question. If you do not understand how to enter data through a Windows based program then stick to console input.
Rate this: bad
Please Sign up or sign in to vote.

Solution 2

See my answer to this question[^]. Visual C++ Express has ready made templates for producing simple Windows based programs.
Rate this: bad
Please Sign up or sign in to vote.

Solution 1

Looks like some basic vector operation.

Hmmm... what about a UI where you first get two vectors into system and then ask user about the operation they want to do. Execute the selected operation internally.

Lets say, as per your code it's a vector that should have 5 integers.

For primitive type, UI design:
Vector 1: 5 textboxes that takes integer
Vector 2: 5 textboxes that takes integer
Then four buttons, one each for different operation.
Based on the button selected show the final vector on screen with some helpful text.
Rate this: bad
Please Sign up or sign in to vote.

Solution 4

Would you mind send your code to me?

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
Top Experts
Last 24hrsThis month

Advertise | Privacy |
Web02 | 2.8.170813.1 | Last Updated 8 Sep 2010
Copyright © CodeProject, 1999-2017
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100