,   CyberForum.ru

"Drawing operation was attempted when there was no current windows" - C++

 
Vadim8063
1 / 1 / 0
: 17.01.2012
: 130
23.11.2012, 10:30     "Drawing operation was attempted when there was no current windows" #1
:
C++
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
#include <cstdlib>
#include <iostream>
#include <conio.h>
#include "windows.h"
#include "tstud.h"
#include "action.h"
#include <string.h>
#include <graphics.h>
using namespace std;
void gotoxy(int xpos, int ypos)
{
  COORD scrn;    
 
  HANDLE hOuput = GetStdHandle(STD_OUTPUT_HANDLE);
 
  scrn.X = xpos; scrn.Y = ypos;
 
  SetConsoleCursorPosition(hOuput,scrn);
}
void Gl_Menu()
{
  system("cls");
  gotoxy(33,11); cout<<"1 - vvod novih dannih";
  gotoxy(33,12); cout<<"2 - prosmotr";
  gotoxy(33,13); cout<<"3 - informatsiya o fakultete";
  gotoxy(33,14); cout<<"4 - informatsiya o gruppe";
  gotoxy(33,15); cout<<"Esc - vyhod";
}
//------------------------------------------------------------
void Menu_1()
{
  system("cls");
  gotoxy(33,11); cout<<"1 - s klaviatury";
  gotoxy(33,12); cout<<"2 - iz faila";
}
 
int main(int argc, char *argv[])
{
    char ch,ch1, *file_n;
      Action Act(20); 
  TStud stud;
  do
  {
   system("cls");
   Gl_Menu();
   ch=ungetch(getch());
   switch(ch)
   {
     case '1':
      Menu_1();
      ch1=ungetch(getch());
      switch(ch1)
             {
        case '1':
          system("cls");
          cin>> stud;
              Act.Add(stud);
          break;
        case '2':
           system("cls"); cout<<"vvedite imya ";
          cin>>file_n;
          Act.FromFile(file_n);
           break;
      };
        break;
     case '2':
       system("cls");
       if(Act.GetN()>0) Act .ToScreen();
       break;
     case '3':
       system("cls"); 
       Act.Obrab_Fac();
       break;
     case '4':
       system("cls"); 
       Act.Obrab_Gr();
       break;
    };
  }while(ch!=27);
 if (Act.GetN()>0) 
      { Act.Sort_Spis();  Act.ToFile(); }
    system("PAUSE");
    return EXIT_SUCCESS;
}
C++
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
#ifndef ACTION_H
#define ACTION_H
#include <stdio.h>
#include "tstud.h"
#include <graphics.h>
/*
 * No description
 */
class Action
{
    private:
  int n;
  TStud  *mas;
 public:
  int GetN() {return n;}
  Action( int ); 
  ~Action();
  void Clear(){ n=0; };
  void Add(TStud);
  void ToFile();
  void FromFile(char*);
  void Obrab_Fac();
  void Obrab_Gr();
  void Sort_Spis();
  void ToScreen();
 
};
 
#endif // ACTION_H
C++
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
#include "action.h"
#include <iostream>
#include <stdio.h>
#include <stdlib.h>
#include <conio.h>
#include <fstream>
#include <string.h>
#include <graphics.h>
 // class's header file
using namespace std;
// class constructor
Action::Action(int nn)
{  n=0; mas=new TStud[nn]; }
//------------------------------------------------------------
Action::~Action()
{  delete [] mas; n=0; }
 
void Action::Add(TStud stud)
{  *(mas+n)= stud; n++; }
 //------------------------------------------------------------
void Action::ToFile()
{
  ofstream zap("Spisok.txt");
  if(!zap) 
  {
     cout<<"nevozmozno otkrit fale lkz zapisi.Nazmite lubyy klavishy...";
    ungetch(getch());  exit(1);
  };
  zap<<n<<endl;
  for(int i=0; i<n; i++)  zap<<*(mas+i);
  zap.close();
  system("cls");
  cout<<"Ââîä ä***ûõ ç*êî*÷å* "<< "("<<GetN()<<zap<<" Nazmite lubyy klavishy..."; ungetch(getch());
}
//------------------------------------------------------------
void Action::FromFile(char *fname)
{
  int nn; TStud stud;
  ifstream chten(fname);
  
  if(!chten.is_open())
    {
    cout<<endl<<"*åâîçìîæ*î îòêðûòü ô*éë äëÿ ÷òå*èÿ.Í*æìèòå ëþáóþ êë*âèøó...";
    ungetch(getch());  exit(1);
  }
  Clear();
  chten>>nn;
  for(int i=0; i<nn; i++)
  {
    chten>> stud;
    system("cls");
    cout<< stud; ungetch(getch());
    Add(stud);
  };
  chten.close();
  system("cls");
  cout<<"Ñ÷åò ç*âåðøå*. Í*æìèòå ëþáóþ êë*âèøó..";
}
//------------------------------------------------------------
void Action::Obrab_Fac()
{
  char sh_fac[3];
  int stud=0, propusk=0;
  float  stud_propusk=0;
  TStud *ptr;
  cout<<" ââåäèòå øèôð ô*êóëüòåò*:";
  cin>> sh_fac;
  for(int i=0; i<n; i++)
  {
    ptr=(mas+i);
    if(strcmp(ptr->Shifr_Fac, sh_fac)==0)
    {
      stud+=ptr->kol_stud;
      propusk+=ptr->prop;
      stud_propusk+=(ptr->prop - ptr->uv_prop);
    }
   }
  if (stud!=0)
  {
   stud_propusk=float (stud_propusk/stud);
    system("cls");
    cout<<"  È*ôîðì*öèÿ ïî ô*êóëüòåòó "<<sh_fac<<": "<<endl;
    cout<<"  îáùåå êîëè÷åñòâî ñòóäå*òîâ : "<< stud<<endl;
    cout<<"  Îáùåå êîëè÷åñòâî ïðîïóùå*ûõ ÷*ñîâ: "<< propusk<<endl;
    cout<<"  Ñðåä*åå êîëè÷åñòâî ïðîïóùå*ûõ ÷*ñîâ ** îä*îãî ñòóäå*ò*:"<< stud_propusk<<endl;
  }
  else cout<<"Ò*êîé ô*êóëüòåò *å **éäå*"<<endl;
  ungetch(getch());
}
//------------------------------------------------------------
void Action::Obrab_Gr()
{
  TStud *ptr; int max=0, imax=0;
  if(n>0)
  {
    for(int i=0; i<n; i++)
    {
      ptr=(mas+i);
      if (ptr->uv_prop>max)
      { imax=i; max=ptr->uv_prop; }
     }
   cout<<" Ñâåäå*èÿ î ãðóïïå, èìåþùåé ì*êñ. êîë-âî ïðîïóñêîâ ïî óâ. ïðè÷è*å:"   <<endl;
  cout<<*(mas+imax);
  ungetch(getch());
 }
}
//------------------------------------------------------------
void Action::Sort_Spis()
{
  TStud tmp, *ptr1, *ptr2;
  if(n>0)
  {
     L1:
     for(int i=0; i<n-1; i++)
     {  ptr1=(mas+i); ptr2=(mas+i+1);
     if (ptr2->prop> ptr1->prop)
      { tmp=*ptr2; *ptr2=*ptr1; *ptr1=tmp; goto L1; }
      }
   }
}
//------------------------------------------------------------
void Action::ToScreen()
{
  int i=0; char ch;
  do
  {
   system("cls");
    cout<<"--- " <<i+1<<"-*ÿ ç*ïèñü èç "<< GetN() <<" ----"<<endl;
    cout<<*(mas+i)<<endl;
    ch=ungetch(getch());
    switch(ch)
    {
      case 0:   ch=ungetch(getch());
      case 72: if (i==0) i=GetN()-1; else i--; break;  // **æìèòå  Page Up
      case 80: if (i==GetN()-1) i=0; else i++;           //**æìèòå Page Down
    }
  } while(ch!=27);      // âûõîä ïî **æ*òèþ Esc
}
C++
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
#ifndef TSTUD_H
#define TSTUD_H
#include <string.h>
#include <fstream.h>
#include <graphics.h>
using namespace std;
/*
 * No description
 */
class TStud
{
protected:
    char Shifr_Fac[3], Name_Fac[4], Shifr_Gr[6];
    int kol_stud;
    int prop;
    int uv_prop;
  friend istream& operator>>(istream&, TStud&);
  friend ostream& operator << (ostream&, TStud&);
 public:
  friend class Action;
};
C++
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
#include <string.h>
#include <iostream>
#include <iomanip.h>
#include "tstud.h" 
#include <graphics.h>
using namespace std;
// class constructor
istream& operator >> (istream& s, TStud & A)
{
 cout<<"ââåäèòå øèôð ô*êóëüòåò*: "; s>>A.Shifr_Fac;
 cout<<" ââåäèòå **çâ**èå ô*êóëüòåò*: "; s>>A.Name_Fac;
 cout<<" ââåäèòå øèôð ãðóïïû: "; s>>A.Shifr_Gr;
 cout<<" ââåäèòå êîëè÷åñòâî ñòóäå*òîâ â ãðóïïå"; s>>A.kol_stud;
 cout<<" ââåäèòå îáùåå êîëè÷åñòâî ïðîïóñêîâ â ãðóïïå"; s>>A.prop;
 cout<<" ââåäèòå êîëè÷åñòâî ïðîïóñêîâ ïî óâ*æèòåëü*îé ïðè÷è*å"; s>>A.uv_prop;
 return s;
}
//------------------------------------------------------------
ostream& operator << (ostream& s, TStud& A)
{
 cout<<" øèôð ô*êóëüòåò*: "; s<<setw(2)<<A.Shifr_Fac<<endl;
 cout<<" **çâ**èå ô*êóëüòåò*: "; s<<setw(3)<<A.Name_Fac<<endl;
 cout<<" øèôð ãðóïïû: "; s<<setw(5)<<A.Shifr_Gr<<endl;
 cout<<" êîëè÷åñòâî ñòóäå*òîâ â ãðóïïå: "; s<<A.kol_stud<<endl;
 cout<<" îáùåå êîëè÷åñòâî ïðîïóñêîâ â ãðóïïå: "; s<<A.prop<<endl;
 cout<<" êîëè÷åñòâî ïðîïóñêîâ ïî óâ*æèòåëü*îé ïðè÷è*å: "; s<<A.uv_prop<<endl;
 return s;
}
. "Drawing operation was attempted when there was no current windows"

15 55
,
Similar
41792 / 34177 / 6122
: 12.04.2006
: 57,940
23.11.2012, 10:30     "Drawing operation was attempted when there was no current windows"
:

"" "", "" "". C++
C++ "a" "o" "A" "O".
C++ "" "" "" "".
C++ "Drawing operation was attempted when there was no current window"
C++ "", "", ".
C++ Drawing operation was attempted when there was no current window. ?
C++ Drawing operation was attemted when there was no current window
"", " ", " " C++



:
.

: 21:13. GMT +3.
- , ,
-
Powered by vBulletin® Version 3.8.9
Copyright ©2000 - 2016, vBulletin Solutions, Inc.
@Mail.ru