![]() |
|
|
Регистрация Восстановить пароль |
Регистрация | Задать вопрос |
Заплачу за решение |
Новые сообщения |
Сообщения за день |
Расширенный поиск |
Правила |
Всё прочитано |
![]() |
|
Опции темы | Поиск в этой теме |
![]() |
#1 |
Пользователь
Регистрация: 12.05.2009
Сообщений: 32
|
![]()
Как исправить???
#include "stdafx.h" #include <iostream> #include <string.h> using namespace std; class Bankomat_class { int id; int minsum; int maxsum; int nom10; int nom50; int nom100; int nom500; int nom1000; public: Bankomat_class(int nomin1000,int nomin500,int nomin100,int nomin50,int nomin10 , int min, int max, int idi): nom1000(nomin1000), nom500(nomin500), nom100(nomin100), nom50(nomin50), nom10(nomin10), minsum(min), maxsum(max), id(idi){} Bankomat_class(): id(0), nom10(0), nom50(0), nom100(0), nom500(0), nom1000(0), minsum(0), maxsum(0) {} friend Bankomat_class operator+(Bankomat_class &v); friend Bankomat_class operator-(Bankomat_class &s); friend ostream& operator<<(ostream& t,const Bankomat_class &r); friend istream& operator>>(istream& t, Bankomat_class &r); Bankomat_class(Bankomat_class &a): nom1000(a.nom1000), nom500(a.nom500), nom100(a.nom100), nom50(a.nom50), nom10(a.nom10), minsum(a.minsum), maxsum(a.maxsum), id(a.id){} char* toString(); int getnumber (int id); }; ostream& operator<<(ostream& t,const Bankomat_class &r) { return (t<< "\n nom1000: " << r.nom1000 << "\n nom500: " << r.nom500<< "\n nom100: " << r.nom100<< "\n nom50: " << r.nom50<< "\n nom10: " << r.nom10 << "\n maxsum: " << r.maxsum << "\n minsum: " << r.minsum<< "\n id: "<< r.id);} char* Bankomat_class::toString() {char string[25]; return strcat(strcat(strcat(strcat(strcat( strcat(strcat(strcat("id= ", itoa(id,string,10)),itoa(maxsum,str ing,10)),itoa(minsum,string,10)),it oa(nom1000,string,10)),itoa(nom500, string,10)),itoa(nom100,string,10)) ,itoa(nom50,string,10)),itoa(nom10, string,10)); } istream& operator>>(istream& t, Bankomat_class &r){ cout << "nom1000: \n " ; t >> r.nom1000; cout << "nom 500: \n" ; t >> r.nom500; cout << "nom100: \n " ; t >> r.nom100; cout << "nom 50: \n" ; t >> r.nom50; cout << "nom 10: \n" ; t >> r.nom10; cout << "maxsum: \n " ; t >> r.maxsum; cout << "minsum: \n " ; t >> r.minsum; cout << "id: \n " ; t >> r.id; cout << " \n "; return t; } int Bankomat_class:: getnumber (int id){ int i; i=id; return i;} Bankomat_class operator+(Bankomat_class &v){ Bankomat_class ref; int nom1000, nom500, nom100, nom50, nom10; ref.nom1000=v.nom1000+nom1000; ref.nom500=v.nom500+nom500; ref.nom100=v.nom100+nom100; ref.nom50=v.nom50+nom50; ref.nom10=v.nom10+nom10; return v; } Bankomat_class operator-(Bankomat_class &s){ Bankomat_class ref; int nom1000, nom500, nom100, nom50, nom10; ref.nom1000=nom1000-s.nom1000; ref.nom500=nom500-s.nom500; ref.nom100=nom100-s.nom100 ; ref.nom50=nom50-s.nom50; ref.nom10=nom10-s.nom10; return s;} int _tmain(int argc, _TCHAR* argv[]) { Bankomat_class l; Bankomat_class bankom(4,5,6,7,8,10,25000,123); Bankomat_class bank(l); cout<<"1.Snyatie deneg \n"; cout<<"2.Zachislenie deneg \n"; int n; cout<<"Vvedite nomer operacii\n"; cin>>n; cout<<"\n proverka \n"; cout <<bankom; cout<< "\n kol-vo nominalov v bankomate \n"; cin>>l; cout<<l; bank.toString(); if(n==1) {cout<<"\n proverka snyatiya \n"; int nom1000, nom500, nom100, nom50, nom10; Bankomat_class f=bank-bankom; cout<< " \n "<<f; } else { if (n==2){ cout<<"\n proverka summi \n"; int nom1000, nom500, nom100, nom50, nom10; Bankomat_class q=bank+bankom; cout<< " \n "<<q; } else {cout << " \n nekorektnaya operachiya proverki \n";}}; int a; cin>>a; return 0; } 1>c:\visual studio 2008\projects\перегрузка\перегрузка \перегрузка.cpp(148) : error C2676: бинарный '-': 'Bankomat_class' не определяет этот оператор или преобразование к типу приемлемо к встроенному оператору 1>c:\visual studio 2008\projects\перегрузка\перегрузка \перегрузка.cpp(155) : error C2676: бинарный '+': 'Bankomat_class' не определяет этот оператор или преобразование к типу приемлемо к встроенному оператору |
![]() |
![]() |
![]() |
Опции темы | Поиск в этой теме |
![]() |
||||
Тема | Автор | Раздел | Ответов | Последнее сообщение |
Где ошибка? where is error? | adam+ | Общие вопросы C/C++ | 14 | 10.02.2010 14:17 |
Ошибка I/O error 104 | ptz2010 | Общие вопросы Delphi | 8 | 31.03.2009 20:45 |
Ошибка I/O error 6 | Волк | Общие вопросы Delphi | 8 | 09.02.2009 14:12 |
Ошибка OLE Error 800A03EC | fluxion | БД в Delphi | 4 | 02.05.2008 05:12 |
ошибка I/O error 32 | kolduev | Помощь студентам | 7 | 29.02.2008 20:22 |