473,378 Members | 1,360 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,378 software developers and data experts.

array variable not working, x[0] is getting over written with value of xx[1]

#include<stdio.h>
#include<iostream>
#include<graphics.h>
#include<conio.h>
#include<math.h>
using namespace std;

using namespace std;
main()
{
int x,y,leftbit[]={0,0},rightbit[]={0,0},topbit[]={0,0},bottombit[]={0,0},flag=0,i,xmin,xmax,ymin,ymax;
int xx[1],yy[1],xb[1],xt[1],yl[1],yr[1],m;
int a[3],o[3];

cout<<"Enter the co-ordinates of the line ";

cout<<"\nPoint A :- ";
cin>>xx[0];
cin>>yy[0];

cout<<"\nPoint B :- ";
cin>>xx[1];//xx[0] is getting over written at xx[1]
cin>>yy[1];

initwindow(700,700);

line(xx[0],yy[0],xx[1],yy[1]);

cout<<xx[0]<<" "<<yy[0]<<"\n";
cout<<xx[1]<<" "<<yy[1];
Sep 12 '14 #1
1 1096
weaknessforcats
9,208 Expert Mod 8TB
xx is an array of one element: int xx[1].

That means xx[0] is the only element yet you cin >> xx[1]. There is no xx[1] so you corrupt your local stack frame.
Sep 12 '14 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

13
by: Dave Smithz | last post by:
Hi there, I have a php script that does some form input validation. As it verifies each field if the field has incorrect data, it appends an error message to an $error array. E.g. if...
1
by: MC | last post by:
Hi to all, I would like to use in a XSL stylesheet an array variable which is defined in a Java program. For example, in my program, i defined a tab variable String tab = {"first", "second",...
2
by: Augusto Cesar | last post by:
Hello people. How can I Pass ASP Array variable to Javascript; I´m to trying this: <script language="JavaScript"> var x = new Array(10);
15
by: thinktwice | last post by:
char a = { 0 } is it ok?
5
by: Mercy | last post by:
I guess my C++ is pretty darn rusty. I was just looking over sample C++ code for practice... and I'm kind of confused about this code fragment: int sector2; int i = 3; memset(sector2,...
1
by: Raju5725 | last post by:
Hi All, I struck up with some intrested senario at my application development...hope some body will guide me or sends me some code snippets.... Thanks in advance. Senario is like this..... ...
3
by: Samant.Trupti | last post by:
HI, I want to dynamically allocate array variable of type LPWSTR. Code looks like this... main() { LPWSTR *wstr; int count = Foo (wstr); for (int i = 0; i < count; i++) //print each...
28
by: Trups | last post by:
HI, I want to dynamically allocate array variable of type LPWSTR. Code looks like this... main() { LPWSTR *wstr; int count = Foo (wstr); for (int i = 0; i < count; i++)
2
by: luftikus143 | last post by:
Hi there, I have an array, which stores in the first dimension a counter for the number of sets, and in the second the value: $value I found somewhere how to find min and max values in such...
9
vikas251074
by: vikas251074 | last post by:
I am not getting date value in spite of my good effort. This code was working in my last office where I work. Now I am trying to work at my home pc. but not getting date value. Any can help me why...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.