473,327 Members | 1,892 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,327 software developers and data experts.

comparing two sets of values in c++

EXPLAINATION: what if i have 3 set of values
e.g
1,2,3,4,5

7,8,9,4,5

9,6,3,2,1


i want to use 3 variables a,b,c one for each set of values

QUESTION: now my question is that how do i change the values continously in a b and c so that each value from one set gets compared with the others in every possible way?????
how do i write this programme in c++????
Nov 7 '08 #1
5 7201
r035198x
13,262 8TB
Read about how to use arrays.
Nov 7 '08 #2
Expand|Select|Wrap|Line Numbers
  1. main()
  2. {
  3.         int arr1[]={your first set};
  4.         int arr[2}={ your second set}
  5. int i,j;
  6. for(i=j=0;i<first array size,j<second array size; i++,j++)
  7. {
  8.                if(arr[i]==arr[j])
  9. {
  10.             printf("equal");
  11. }
  12. else
  13. {
  14.          printf("unequal");
  15. }
  16. getch()
  17. }
Nov 8 '08 #3
JosAH
11,448 Expert 8TB
main()
{
int arr1[]={your first set};
int arr[2}={ your second set}
int i,j;
for(i=j=0;i<first array size,j<second array size; i++,j++)
{
if(arr[i]==arr[j])
{
printf("equal");
}
else
{
printf("unequal");
}
getch()
}
Congratulations, you have just been nominated for the CCOTD contest (*) stay tuned.

kind regards,

Jos

(*) Crappiest Code Of The Day
Nov 8 '08 #4
boxfish
469 Expert 256MB
You will probably need nested for loops to do this.
Congratulations, you have just been nominated for the CCOTD contest (*)
Here is my entry:
Expand|Select|Wrap|Line Numbers
  1. #include "iostream.h"
  2. main() {
  3. for (i = 1, i < 100, i = i + 1){;
  4. cout >> Hello world};
  5. cin.get;
Sorry, shahzeb. Please read this bit of the posting guidelines.
Nov 8 '08 #5
donbock
2,426 Expert 2GB
QUESTION: now my question is that how do i change the values continously in a b and c so that each value from one set gets compared with the others in every possible way?????
how do i write this programme in c++????
What do you mean "each value from one set gets compared with the others in every possible way"? Each such comparison could have a different value ... do you envisage some way of amalgamating all of these comparisons into a single results? Are you just looking for a framework for performing these comparisons that you'll insert more code into later?

Oh yeah; almost forgot my entry for CCOTD. I can't compete with these, so in the "so bad its good" category I refer you to
International Obfuscated C Contest
The Underhanded C Contest
Duff's Device
Don't try any of these at home.
Nov 8 '08 #6

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

Similar topics

3
by: Andy Fish | last post by:
Hi, I just found this template in someone else's xslt (it's Microsoft's "word2html" stylesheet to convert WordProcessingML to HTML) <xsl:template match="WX:sect"> <xsl:variable...
12
by: NickName | last post by:
I have the following situation. One set of data has 274 rows (set2) and anther has 264 (set1). Both data sets are similar in structure as well as values for both of them were extracts from the...
41
by: Odd-R. | last post by:
I have to lists, A and B, that may, or may not be equal. If they are not identical, I want the output to be three new lists, X,Y and Z where X has all the elements that are in A, but not in B, and...
2
by: Manny Chohan | last post by:
Hi, i have two datetime values in format 11/22/04 9:00 AM and 11/22/04 9:30 AM. How can i compare dates .net c# or if there is any other way such as Javascript. Thanks Manny
19
by: Dennis | last post by:
I have a public variable in a class of type color declared as follows: public mycolor as color = color.Empty I want to check to see if the user has specified a color like; if mycolor =...
11
by: John Salerno | last post by:
I'd like to compare the values in two different sets to test if any of the positions in either set share the same value (e.g., if the third element of each set is an 'a', then the test fails). I...
2
by: Yash | last post by:
Hi, We are in the process of tuning the performance of our stored procs in SQL 2000 and are looking for a tool that would help us in comparing the result sets of an old SP and a modified SP. The...
1
jenkinsloveschicken
by: jenkinsloveschicken | last post by:
Is it possible to compare a single value to many in a single statement? Here is what I am attempting to do: 1. Users lands on page and via a cookie check function they are identified. 2. A query...
0
by: DomiNeug | last post by:
Hello, Since a while i have to find a way of comparing "Sets" (multiple int Values) and so to find equal sets. There simply 3 tables ValueList with: ID int ValueListHasValue: ID int, ValueListID...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
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
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 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 former...

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.