Как добавить графический интерфейс в код "Северо-Западного метода" на языке C++ ?
Привет
Я делаю программу "метод северо - западного угла"
Я написал программу на c++
Мне нужно преобразовать его в приложение графического интерфейса с помощью c++ простым способом
Мне нужна помощь
или если есть готовое приложение,из которого я могу узнать, как оно работает, или кто-то может мне в этом помочь, это будет здорово
Заранее спасибо
Что я уже пробовал:
#include<iostream> #include<stdio.h> #include<conio.h> #include<iomanip> #include<stdlib.h> using namespace std; #define MAX 50 enum boolean{FALSE,TRUE}; class nwcmethod{ int data[MAX][MAX]; int requered[MAX]; int capacity[MAX]; int allocation[MAX][MAX]; int no_of_rows,no_of_columns,no_of_allocation; public: nwcmethod(){ for(int i=0;i<max;i++){ capacity[i]="0; " requered[i]="0; " for(int="" j="0;j<MAX;j++){ " data[i][j]="0; " allocation[i][j]="0; " } ="" no_of_rows="no_of_columns=no_of_allocation=0; " void="" setcolumn(int="" no) {no_of_columns="no;}; " setrow(int="" no) {no_of_rows="no;} " getdata(); ="" getcapacity(); ="" getrequiredvalue(); ="" makeallocation(); ="" boolean="" checkvalue(int[],int); ="" display(); }; boolean="" nwcmethod::checkvalue(int="" arr[],int="" no){ ="" i="0;i<no;i++) " if(arr[i]!="0) " return="" false; ="" true; } void="" arraycopy(int="" start,int="" end,int="" array1[],int="" start1,int="" array2[]){ ="" array2[j]="array1[i]; " } } int="" gettotal(int="" array[],int="" int="" sum="0; " sum+="array[i]; " sum; } ="" nwcmethod::makeallocation() ="" { ="" temp_requered[max]="{0}; " temp_capacity[max]="{0}; " sum_of_cap,sum_of_req; ="" sum_of_cap="getTotal(capacity,no_of_rows); " sum_of_req="getTotal(requered,no_of_columns); " if(sum_of_cap!="sum_of_req){ " if(sum_of_cap="">sum_of_req){ for(j=0;j<no_of_rows;j++) data[j] [no_of_columns]="0; " requered[no_of_columns]="sum_of_cap-sum_of_req; " no_of_columns++; ="" } ="" else{ ="" for(j="0;j<no_of_columns;j++) " data[no_of_rows][j]="0; " capacity[no_of_rows]="sum_of_req-sum_of_cap; " no_of_rows++; ="" i="j=0; " arraycopy(0,no_of_rows,capacity,0,temp_capacity); ="" arraycopy(0,no_of_columns,requered,0,temp_requered); ="" while(! checkvalue(temp_capacity,no_of_rows)="" ||="" ! checkvalue(temp_requered,no_of_columns)){ ="" if(temp_capacity[i]="">temp_requered[j]) { allocation[i][j]=temp_requered[j]; temp_capacity[i]-=temp_requered[j]; temp_requered[j]=0; j++; } else if(temp_capacity[i]<temp_requered[j]){ allocation[i][j]="temp_capacity[i]; " temp_requered[j]-="temp_capacity[i]; " temp_capacity[i]="0; " i++; ="" } ="" else{ ="" temp_capacity[i]="temp_requered[" j]="0; " j++; ="" no_of_allocation++; ="" } } void="" nwcmethod::getcapacity(){="" cout<<"----------------------------------"<<endl; ="" cout<<"enter="" capacity="" for="" each="" source="" :="" \n"; ="" for(int="" i="0;i<no_of_rows;i++){ " cout<<"s"<<i+1<<"="" "; ="" cin="">>capacity[i]; } } void nwcmethod::getRequiredValue(){ cout<<"----------------------------------"<<endl; cout<<"enter="" required="" unit="" value="" for="" each="" destination="" :="" \n"; ="" for(int="" i="0;i<no_of_columns;i++) { " cout<<"d"<<i+1<<"="" "; ="" cin="">>requered[i]; } } void nwcmethod::display(){ int i; cout<<"\ngiven data :\n"; cout<<setw(9); for(i="0;i<no_of_columns;i++) " cout<<"d"<<i+1<<setw(4); ="" cout<<setw(5)<<"cap"<<endl<<setw(0); ="" cout<<setw(3)<<"s"<<i+1; ="" for(int="" j="0;j<no_of_columns;j++) " cout<<setw(5)<<data[i][j]; ="" cout<<setw(5)<<capacity[i]<<endl; ="" } ="" cout<<setw(4)<<"req"; ="" cout<<setw(5)<<requered[i]; ="" cout<<"\n\n="" after="" allocation="" :\n"; ="" if(allocation[i][j]!="0) " cout<<"\t"<<data[i][j]<<"*"<<allocation[i][j]; ="" else ="" cout<<"\t"<<data[i][j]; ="" cout<<endl; ="" int="" k="0,sum=0; " ="" cout<<"("<<data[i][j]<<"*"<<allocation[i][j]<<")"; ="" if(k<no_of_allocation-1) ="" { ="" cout<<"+"; ="" k++; ="" sum+="data[i][j]*allocation[i][j]; " cout<<"\nanswer="" :="" "<<sum; ="" if((no_of_rows+no_of_columns-1)="=no_of_allocation){ " cout<<"\nhere"<<no_of_rows<<"+"<<no_of_columns<<"-1="<<no_of_allocation<<" no.="" of="" allocations"; ="" cout<<"\n="" so="" this="" problem="" is="" non-degenarated="" solution"; ="" else{ ="" cout<<"\nhere="" "<<no_of_rows<<"+"<<no_of_columns<<"-1="" !="<<no_of_allocation<<" no="" degenarated="" } } void="" nwcmethod::getdata() {="" cout<<"----------------------------------"<<endl; ="" cout<<"enter="" source="" to="" destination="" data:"<<endl;="" i="0;i<no_of_rows;i++){" "<<i<<"th="" row="" :"; ="" cin="">>data[i][j]; } } } int main() { cout<<"================================================"<<endl; cout<<"so="" .="" this="" north="" west="" method="" c++="" program="" "<<endl; ="" cout<<"programmed="" by="" mo="" ashameikh="" ,="" alfadel="" and="" rayan"<<endl; ="" cout<<"="==============================================="<<endl; " cout<<endl; ="" nwcmethod="" m1; ="" int="" r,c; ="" cout<<"----------------------------------"<<endl; ="" cout<<"enter="" no="" of="" rows="" :="" "; ="" cin="">>r; cout<<"----------------------------------"<<endl; cout<<"enter="" no="" of="" columns="" :="" ";="" ="" cin="">>c; cout<<"----------------------------------"<