Hi...
I'm having some difficulties to sort two different array (say X and Y), these arrays state the coordinate in x and y axis..so, if X change, Y has to change.
I have unsorted array and I want to eliminate array with the same value...
Here's my code which doesn't work: -
-
#include <stdlib.h>
-
#include <math.h>
-
#include <stdio.h>
-
#include <conio.h>
-
-
-
int main ()
-
{
-
float X[4][4][24],Y[4][4][24],P[4][4][24],Q[4][4][24],R[4][4][24],S[4][4][24];
-
int i,j,k,l,m,n,a,b,c,d;
-
-
-
X[0][0][0]=-1.414214; Y[0][0][0]=0.000000;
-
X[0][0][1]=-1.414214; Y[0][0][1]=0.000000;
-
X[0][0][2]=-1.000000; Y[0][0][2]=0.414214;
-
X[0][0][3]=-1.414214; Y[0][0][3]=0.000000;
-
X[0][0][4]=-1.000000; Y[0][0][4]=0.000000;
-
X[0][1][0]=-0.707107; Y[0][1][0]=0.707107;
-
X[0][1][1]=0.000000; Y[0][1][1]=0.000000;
-
X[0][1][2]=-1.000000; Y[0][1][2]=0.414214;
-
X[0][1][3]=0.000000; Y[0][1][3]=0.000000;
-
X[0][1][4]=0.000000; Y[0][1][4]=0.000000;
-
X[0][1][5]=0.000000; Y[0][1][5]=0.000000;
-
X[0][1][6]=0.000000; Y[0][1][6]=0.000000;
-
X[0][1][7]=-1.000000; Y[0][1][7]=0.000000;
-
X[0][1][8]=0.000000; Y[0][1][8]=0.000000;
-
X[0][2][0]=-1.414214; Y[0][2][0]=0.000000;
-
X[0][2][1]=-1.414214; Y[0][2][1]=0.000000;
-
X[0][2][2]=-1.000000; Y[0][2][2]=-0.414214;
-
X[0][2][3]=-1.000000; Y[0][2][3]=0.000000;
-
X[0][3][0]=-0.707107; Y[0][3][0]=-0.707107;
-
X[0][3][1]=0.000000; Y[0][3][1]=0.000000;
-
X[0][3][2]=-1.000000; Y[0][3][2]=-0.414214;
-
X[0][3][3]=0.000000; Y[0][3][3]=0.000000;
-
X[0][3][4]=0.000000; Y[0][3][4]=0.000000;
-
X[0][3][5]=0.000000; Y[0][3][5]=0.000000;
-
X[0][3][6]=0.000000; Y[0][3][6]=0.000000;
-
X[0][3][7]=-1.000000; Y[0][3][7]=0.000000;
-
X[0][3][8]=0.000000; Y[0][3][8]=0.000000;
-
X[1][0][0]=-0.414214; Y[1][0][0]=1.000000;
-
X[1][0][1]=0.000000; Y[1][0][1]=1.414214;
-
X[1][0][2]=0.000000; Y[1][0][2]=1.414214;
-
X[1][0][3]=0.000000; Y[1][0][3]=1.000000;
-
X[1][1][0]=0.000000; Y[1][1][0]=1.414214;
-
X[1][1][1]=0.000000; Y[1][1][1]=1.414214;
-
X[1][1][2]=0.414214; Y[1][1][2]=1.000000;
-
X[1][1][3]=0.000000; Y[1][1][3]=1.414214;
-
X[1][1][4]=0.000000; Y[1][1][4]=1.000000;
-
X[1][1][5]=-0.707107; Y[1][1][5]=0.707107;
-
X[1][2][0]=-0.707107; Y[1][2][0]=0.707107;
-
X[1][2][1]=0.000000; Y[1][2][1]=0.000000;
-
X[1][2][2]=-0.414214; Y[1][2][2]=1.000000;
-
X[1][2][3]=0.000000; Y[1][2][3]=0.000000;
-
X[1][2][4]=0.000000; Y[1][2][4]=0.000000;
-
X[1][2][5]=0.000000; Y[1][2][5]=0.000000;
-
X[1][2][6]=0.000000; Y[1][2][6]=0.000000;
-
X[1][2][7]=0.000000; Y[1][2][7]=1.000000;
-
X[1][2][8]=0.000000; Y[1][2][8]=0.000000;
-
X[1][3][0]=0.000000; Y[1][3][0]=0.000000;
-
X[1][3][1]=0.707107; Y[1][3][1]=0.707107;
-
X[1][3][2]=0.000000; Y[1][3][2]=0.000000;
-
X[1][3][3]=0.000000; Y[1][3][3]=0.000000;
-
X[1][3][4]=0.414214; Y[1][3][4]=1.000000;
-
X[1][3][5]=0.000000; Y[1][3][5]=0.000000;
-
X[1][3][6]=0.000000; Y[1][3][6]=0.000000;
-
X[1][3][7]=0.000000; Y[1][3][7]=1.000000;
-
X[1][3][8]=0.000000; Y[1][3][8]=0.000000;
-
X[1][3][9]=0.000000; Y[1][3][9]=0.000000;
-
X[1][3][10]=0.000000; Y[1][3][10]=0.000000;
-
X[1][3][11]=0.000000; Y[1][3][11]=0.000000;
-
X[1][3][12]=0.000000; Y[1][3][12]=0.000000;
-
X[1][3][13]=0.000000; Y[1][3][13]=0.000000;
-
X[1][3][14]=0.000000; Y[1][3][14]=0.000000;
-
X[1][3][15]=0.000000; Y[1][3][15]=0.000000;
-
X[1][3][16]=-0.707107; Y[1][3][16]=-0.707107;
-
-
-
-
-
for (d=0;d<2;d++) {
-
for (l=0;l<2;l++){
-
k=0;
-
for (i=0;i<17;i++){
-
if (X[d][l][i] != X[d][l][i+1] && Y[d][l][i] !=Y[d][l][i+1]){
-
for (j=k;j<=k;j++){
-
R[d][l][j]=X[d][l][i];
-
S[d][l][j]=Y[d][l][i];
-
printf ("[%d][%d][%d]\t%f\t%f\n",d,l,j,R[d][l][j],S[d][l][j]);
-
if (R[d][l][j]>R[d][l][j+1] && S[d][l][j+1]){
-
for (c=m;c<=m;c++){
-
P[d][l][c]=R[d][l][j];
-
Q[d][l][c]=S[d][l][j];
-
printf ("[%d][%d][%d]\t%f\t%f\n",d,l,c,P[d][l][c],Q[d][l][c]);
-
}m++;
-
}
-
}k++;
-
}
-
}
-
}
-
}
-
-
-
getch ();
-
}
-
-
I don't know why, but there are some arrays which are not eliminated even though the value are same.
Could you help me please?
Thank you
0 2172 Sign in to post your reply or Sign up for a free account.
Similar topics |
by: Robert |
last post by:
Im a beginner in PHP and Im having a problem with this code. Im
trying to remove duplicate elements from an array created via $_GET.
I want users to be able to click on a link which sends an email
address to an array. I just want to remove duplicate email addresses
from the array. Ive tried array_unique() on my test server but it
doesnt work. So i tried to remove duplicates myself before storing
them into the array. The script works...
|
by: gilgantic |
last post by:
Is there anyway of eliminating duplicate entries as the database loads data
using SQLLDR and/or .ctl (Control File)?
I use the following command line using SQLLDR and a control file to load my
data, but the sample.dat file has duplicate information. I would like to be
able to eliminate this, since I have know ability to manipulate the sample.dat.
${ORACLE_HOME}/bin/sqlldr $USERPW /home/sample/sample.ctl
############# sample.ctl...
|
by: Tony Young |
last post by:
Hi,
I have a multimap container. I want to eliminate all "duplicate"
elements. By duplicate I mean something like (3, 4), (4, 3) and (4, 3),
in which I want to eliminate any two of these three. The most
straightforward way I can think of is to first swap every member such
that every member has its key smaller than its value. Then loop thru
the multipmap and erase duplicates (please see the loop below). Is
there a more automatic way...
|
by: Kay |
last post by:
ABC
ASF
DFS
ASS
ABC <--- Duplicate
JJK
I want to store above char in an arry, but I'm not sure I'm right or not
anyone can guide me or give me some suggestions, Thx?
|
by: Suma |
last post by:
A newbie question :
I have a vector of objects(pointers) . I have a function which
overloads the less than operator . I can sort the objects without a
problem. However when I pass the same function as an arg to the unique
function, I still see the duplicate objects.
Shouldnt unique be aple to operate with just the less_than overload-
since if both the predicates constant1 < constant2 and constan2 <
constant1 return false implies...
| |
by: sandi |
last post by:
hi there
i have fields name called ..
PAF (text) , PNo (Number ) , LastName (Text)
2006/214/2 , 220101 , Winne
2006/321/3, 521496 , Joe
2006/321/1 , 521496 , Joe
2006/541/4 , 521496 , Joe
|
by: comatose |
last post by:
if I have an array of ten items how can I sort the first five items in
the array without sorting the second five items?
|
by: Mokita |
last post by:
Hello,
I am working with Taverna to build a workflow. Taverna has a beanshell where I can program in java. I am having some problems in writing a script, where I want to eliminate the duplicates in an array (String).
for (int k=0; k<myLength; k++){
boolean isthere=false;
for (int l=0; l<sizeres; l++){
if (res.equals(my)){
|
by: cmdolcet69 |
last post by:
i need to find a way to look through my _ReadingArrayList3 and see if any number stored in the inarrayindex are duplicated. I need to first collect all the data and place it into the array, once the array is filled i call my sort SortArray() Sub that will look at every arrayindex in the _ReadingArrayList3, at this time after that i can;t seem to find out how to compare values in the array. Below is the code i have been working on.
Thanks
...
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look !
Part I. Meaning of...
|
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth.
The Art of Business Website Design
Your website is...
| |
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules.
He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms.
Adolph will...
|
by: conductexam |
last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one.
At the time of converting from word file to html my equations which are in the word document file was convert into image.
Globals.ThisAddIn.Application.ActiveDocument.Select();...
|
by: TSSRALBI |
last post by:
Hello
I'm a network technician in training and I need your help.
I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs.
The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols.
I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
|
by: 6302768590 |
last post by:
Hai team
i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
| |
by: bsmnconsultancy |
last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...
| |