在创建GUI时需要帮助.请 [英] I need help in GUI-creating. Please

查看:103
本文介绍了在创建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;
}

推荐答案

在这种情况下,如何输入这两个向量?在我的代码中,向量是默认设置的.
In this case, how to make the input of these two vectors? In my code vectors are set by default.


请参阅我对
See my answer to this question[^]. Visual C++ Express has ready made templates for producing simple Windows based programs.


看起来像一些基本的矢量操作.

嗯...关于UI的情况,首先将两个向量输入系统,然后向用户询问他们要执行的操作.在内部执行选择的操作.

可以说,根据您的代码,它是一个应具有5个整数的向量.

对于原始类型,UI设计:
矢量1:5个整数的文本框
向量2:5个采用整数的文本框
然后是四个按钮,每个按钮分别用于不同的操作.
根据选择的按钮,在屏幕上显示带有一些有用文本的最终矢量.
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.


这篇关于在创建GUI时需要帮助.请的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆