GIDForums  

Go Back   GIDForums > Computer Programming Forums > C++ Forum
User Name
Password
Register FAQ Members List Calendar Search Today's Posts Mark Forums Read

 
 
Thread Tools Search this Thread Rate Thread
  #1  
Old 11-Nov-2004, 11:30
Krc784 Krc784 is offline
New Member
 
Join Date: Nov 2004
Posts: 9
Krc784 is on a distinguished road

Small help with this build error!!


I keep getting this build error saying "stack around the variable 'date' is corrupted"...please help me so i can continue writing my program for class...thanks????

CPP / C++ / C Code:

#include <iostream>
using namespace std;
 
int main()
{
	int date[8];
	char name;
	int checkTotal;

	cout << "Please enter the date.: ";
	cin >> date[8];
	cout << "Please enter the employees name.: ";
	cin >> name;
	cout << "Please enter the amount of the check recieved.: ";
	cin >> checkTotal;
	return 0;

}
  #2  
Old 11-Nov-2004, 12:03
dsmith's Avatar
dsmith dsmith is offline
Senior Member
 
Join Date: Jan 2004
Location: Utah, USA
Posts: 1,351
dsmith is a glorious beacon of lightdsmith is a glorious beacon of lightdsmith is a glorious beacon of lightdsmith is a glorious beacon of lightdsmith is a glorious beacon of light
Hi Krc784. What compiler/OS are you using? I have never seen an error like that before and I can't find anything "build-wise" wrong with your program. This sounds like a system error or something. Do you have another computer you can try this on? Have you rebooted your computer and tried to compile again?

Program wise, what are you trying to get the user to put in for your date? I am just curios as to why this is an integer array....

Sorry I can't be of more help.
  #3  
Old 11-Nov-2004, 12:25
Dr. Evil Dr. Evil is offline
Member
 
Join Date: Oct 2004
Location: Netherlands
Posts: 120
Dr. Evil will become famous soon enough
I have an idea about what's wrong. When you first declare date[8], it's an array from 0 through 7, stopping before 8. Thus, you're declaring an array with 8 elements, but no 8th element. So, when you say cin>>date[8], you're referring to an integer element that is non-existent. Another thing is that if you want to read in a name string, with more than one character, you want to declare a char array or pointer, and read into that. Like this:
CPP / C++ / C Code:
//...
char name[20];

cout<<"Enter your name";
cin>>name;
//...
  #4  
Old 11-Nov-2004, 13:05
Krc784 Krc784 is offline
New Member
 
Join Date: Nov 2004
Posts: 9
Krc784 is on a distinguished road

Thanks


Quote:
Originally Posted by dsmith
Hi Krc784. What compiler/OS are you using? I have never seen an error like that before and I can't find anything "build-wise" wrong with your program. This sounds like a system error or something. Do you have another computer you can try this on? Have you rebooted your computer and tried to compile again?

Program wise, what are you trying to get the user to put in for your date? I am just curios as to why this is an integer array....

Sorry I can't be of more help.

Well i just saw that date thing when i sent it and i am going to fix it shortly...thats just the beginning of my program and i was having a few problems...but thanks a lot for yalls help and will be asking some more questions soon probably
 
 

Recent GIDBlogWriting a book by crystalattice

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
[Tutorial] GUI programming with FLTK dsmith FLTK Forum 10 03-Oct-2005 15:41
Operator Overloading: << aaroncohn C++ Forum 36 07-Dec-2004 19:22
link error? pablowablo C++ Forum 14 19-Jun-2004 10:00
OpenGL always reports error mvt OpenGL Programming 2 04-Jun-2004 06:42
Visual C++ 6 Compiler error vip3r C++ Forum 2 13-Apr-2004 14:34

Network Sites: GIDNetwork · GIDWebHosts · GIDSearch · Learning Journal by J de Silva, The

All times are GMT -6. The time now is 18:15.


vBulletin, Copyright © 2000 - 2008, Jelsoft Enterprises Ltd.