This is the mail archive of the cygwin@sourceware.cygnus.com mailing list for the Cygwin project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

G++ error or opperator problem ?


Hello support,

Attached is my problem.  Please solve it

Thank you
Riaan Potgieter

I am running Windows95 SR2 and want to use the G++ compiler, but I run into
these problems.


This source code, when compiled, gave some 'warnings', and when executed,
some errors
_________________________________________________________________________

SOURCE CODE
___________

#include <iostream.h>
#include <string>

void main()
{
  int StudNum = 3;
  string StudName[StudNum];
  string StudHigh;
  float StudMark[StudNum];
  float StudAvg = 0, TotalScore = 0, HighScore = 0;
  
  for (int Count = 1; Count <= StudNum; Count++)
  {
    cout << "Type in the name of the Student: ";
    cin >> StudName[Count];
             //Get Student Name
    cout << "Type in the mark for " << StudName[Count] << ": ";
    cin >> StudMark[Count];
             // Get Student Mark
    if (HighScore <= StudMark[Count])
             // Select Highest Score
    {
      HighScore = StudMark[Count];
             // Set Highest Score
      StudHigh = StudName[Count];
             // Set Student Name with highest Score
    }
    TotalScore += StudMark[Count];
             // Add up Student Score
  }

  StudAvg = TotalScore / StudNum;
             // Calculate Student Average
  cout << endl;
  cout << "The average mark is: " << StudAvg << endl;
  cout << StudHigh << " achieved the highest mark" << endl;
}


COMPILE ERRORS/WARNINGS
_______________________

D:\WORK\COS215>g++ hw1.c -o hw1
C:\\PROGRA~1\\GNU\\H-I386~1\\LIB\\GCC-LIB\\i386-cygwin32/cygnus-2.7.2-961023/../../../../../include/g++/std/straits.h: In function `static char * string_char_traits<char>::move(char *, const char *, unsigned int)':
In file included from C:\\PROGRA~1\\GNU\\H-I386~1\\LIB\\GCC-LIB\\i386-cygwin32/cygnus-2.7.2-961023/../../../../../include/g++/std/bastring.h:36,
                 from C:\\PROGRA~1\\GNU\\H-I386~1\\LIB\\GCC-LIB\\i386-cygwin32/cygnus-2.7.2-961023/../../../../../include/g++/string:6,
                 from hw1.c:9:
C:\\PROGRA~1\\GNU\\H-I386~1\\LIB\\GCC-LIB\\i386-cygwin32/cygnus-2.7.2-961023/../../../../../include/g++/std/straits.h:129: warning: implicit declaration of function `int memmove(...)'
C:\\PROGRA~1\\GNU\\H-I386~1\\LIB\\GCC-LIB\\i386-cygwin32/cygnus-2.7.2-961023/../../../../../include/g++/std/straits.h: In function `static char * string_char_traits<char>::set(char *, const char &, unsigned int)':
C:\\PROGRA~1\\GNU\\H-I386~1\\LIB\\GCC-LIB\\i386-cygwin32/cygnus-2.7.2-961023/../../../../../include/g++/std/straits.h:131: warning: implicit declaration of function `int memset(...)'


EXECUTE ERRORS
______________

D:\WORK\COS215>hw1
Type in the name of the Student: 1
Type in the mark for 1: 1
Type in the name of the Student: 2
Type in the mark for 2: 2
Type in the name of the Student: 3
Type in the mark for 3: 3

The average mark is: 2
3 achieved the highest mark
(D:\WORK\COS215\HW1.EXE 1000) In cygwin_except_handler
(D:\WORK\COS215\HW1.EXE 1000) Exception trapped!
(D:\WORK\COS215\HW1.EXE 1000) exception C0000005 at 4014C7
(D:\WORK\COS215\HW1.EXE 1000) exception: ax 403FFFF0 bx 403FFFF0 cx 403FFFF0 dx25DF554
(D:\WORK\COS215\HW1.EXE 1000) exception: si 25DF554 di 25DF558 bp 25DF524 sp 25DF520
(D:\WORK\COS215\HW1.EXE 1000) exception is: STATUS_ACCESS_VIOLATION
(D:\WORK\COS215\HW1.EXE 1000) Stack trace:
(D:\WORK\COS215\HW1.EXE 1000) frame 0: sp = 0x25DF338, pc = 0x1001282A
(D:\WORK\COS215\HW1.EXE 1000) frame 1: sp = 0x25DF354, pc = 0xBFF76780
(D:\WORK\COS215\HW1.EXE 1000) frame 2: sp = 0x25DF378, pc = 0xBFF858F3
(D:\WORK\COS215\HW1.EXE 1000) frame 3: sp = 0x25DF410, pc = 0xFFECBAD7
(D:\WORK\COS215\HW1.EXE 1000) frame 4: sp = 0x25DF524, pc = 0x4014A0
(D:\WORK\COS215\HW1.EXE 1000) frame 5: sp = 0x25DF538, pc = 0x4013BE
(D:\WORK\COS215\HW1.EXE 1000) frame 6: sp = 0x25DF5B0, pc = 0x10011BEB
(D:\WORK\COS215\HW1.EXE 1000) frame 7: sp = 0x25DFE14, pc = 0x10011BFF
(D:\WORK\COS215\HW1.EXE 1000) frame 8: sp = 0x25DFE20, pc = 0x412478
(D:\WORK\COS215\HW1.EXE 1000) frame 9: sp = 0x25DFE30, pc = 0x401012
(D:\WORK\COS215\HW1.EXE 1000) frame 10: sp = 0x25DFE38, pc = 0xBFF88E93
(D:\WORK\COS215\HW1.EXE 1000) frame 11: sp = 0x25DFF78, pc = 0xBFF88D41
(D:\WORK\COS215\HW1.EXE 1000) frame 12: sp = 0x25DFFF4, pc = 0xBFF87759
(D:\WORK\COS215\HW1.EXE 1000) frame 13: sp = 0x815A1E9C, pc = 0x4
(D:\WORK\COS215\HW1.EXE 1000) In cygwin_except_handler
(D:\WORK\COS215\HW1.EXE 1000) Error while dumping state (probably corrupted stack)


What can the problem be?

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]