Click here to Skip to main content
Rate this: bad
good
Please Sign up or sign in to vote.
See more: C++ GUI
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 {
public:
   vect(int=0,int=0,int=0,int=0,int=0);   
   vect operator+(const vect &) const;   
   vect operator-(const vect &) const;
   vect operator*(const vect &); 
   vect operator*(const int &); 
   
   void print() const;
   private:
   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:   ";
   x.print();
   cout<<"\n Vector 2:   ";
   y.print();
   z = x + y;
   cout<<"\n Slozhenie:   ";
   z.print();
   z = x - y;
   cout<<"\n Vichitanie:  ";
   z.print();
   z = x * y;
   cout<<"\n Vector*Vector:   ";
   z.print();
   z = x * scl;
   cout<<"\n Scalar1:   ";
   z.print();
   z = y * scl;
   cout<<"\n Scalar2:   ";
   z.print();
   getch();
   return 0;
}
 
Posted 6-Sep-10 9:10am
Edited 7-Sep-10 1:26am
Aescleal30.2K
v3
Comments
Toli Cuturicu at 6-Sep-10 16:08pm
   
Reason for my vote of 2
Code is not C#, Tags is C#...
cccfff777 at 9-Sep-10 5:07am
   
The tag IS c++/gui
Rate this: bad
good
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.
  Permalink  
Comments
Richard MacCutchan at 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
good
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.
  Permalink  
Rate this: bad
good
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.
  Permalink  
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 4

Would you mind send your code to me?
 
286035062@qq.com
  Permalink  

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

  Print Answers RSS
0 OriginalGriff 6,569
1 Sergey Alexandrovich Kryukov 6,168
2 DamithSL 5,228
3 Manas Bhardwaj 4,717
4 Maciej Los 4,150


Advertise | Privacy | Mobile
Web02 | 2.8.1411022.1 | Last Updated 8 Sep 2010
Copyright © CodeProject, 1999-2014
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