Forum     

Go Back   Digit Technology Discussion Forum > Software > Programming
Register FAQ Calendar Mark Forums Read

Programming The destination for developers - C, C++, Java, Python and the lot


Reply
 
LinkBack Thread Tools Display Modes
Old 18-07-2010, 01:22 PM   #1 (permalink)
Designer Here
 
techking_dinesh's Avatar
 
Join Date: Aug 2008
Location: Nashik
Posts: 396
Default Need C programme for Set operations


Hello.
I need a little help with c.

I have to code a programme with following features.
Enter 2 Sets and display them on Screen in sorted order with no elements repeated ( Using array )
Then Using Switch case to perform the following operations
1. Union
2. Intersection
3. difference
4. Symmetric Difference

i tried google and got some codes but those are of high level for me

plz help

I hav managed d most basic part of d code as follows:

Code:
#include<stdio.h>
#include<conio.h>
void main()
{
int a[50],b[50],c[50],size1,size2,i=0,j=0,z;
clrscr();
printf("\n Set Operations Menu");
printf("\n 1. Union of Set");
printf("\n 2. Intersection of Set");
printf("\n 3. Difference of Set");
printf("\n 4. Symmetric Difference of Set");
printf("\n 5. Exit\n\n\n");
// switch(z)
printf("\n Enter the Size of Set A: ");
scanf("%d",&size1);
printf("\n Enter %d elements for set A: ",size1);
for(i=0;i<size1;i++)
    {
    scanf("%d",&a[i]);
    }
printf("\n Enter the Size of Set B: ");
scanf("%d",&size2);
printf("\n Enter %d elements for set B: ",size2);
for(j=0;j<size2;j++)
    {
    scanf("%d",&b[j]);
    }
printf("\n A is ");
printf("A={");
for(i=0;i<size1;i++)
{
printf("%d,",a[i]);
}
printf("\b}");
printf("\n B is ");
printf("B={");
for(j=0;j<size2;j++)
{
printf("%d,",b[j]);
}
printf("\b}");
getch();
}
Waiting for solution
techking_dinesh is offline   Reply With Quote
Advertisements. Register and be a member of the community to get rid of them.
Advertisement

Old 18-07-2010, 07:31 PM   #2 (permalink)
XLr8
 
arpanmukherjee1's Avatar
 
Join Date: Sep 2008
Posts: 637
Default Re: Need C programme for Set operations

Quote:
Originally Posted by techking_dinesh View Post
Hello.
I need a little help with c.

I have to code a programme with following features.
Enter 2 Sets and display them on Screen in sorted order with no elements repeated ( Using array )
Then Using Switch case to perform the following operations
1. Union
2. Intersection
3. difference
4. Symmetric Difference
1. merging two array
2. sorting the array Bubble Search
3. UNION step 1,2
4. INTERSECTION take 1st ele of arr1 and try to find it in arr2. repete for all elements of arr1. if found place in arr3. sort arr3.
5. DIFF - apply step 4. logic with a slight twist
6. dont know what "Symmetric Difference" is
__________________
Quote:
There are more things in heaven and earth, Horatio,
Than are dreamt of in your philosophy.
arpanmukherjee1 is offline   Reply With Quote
Old 18-07-2010, 08:11 PM   #3 (permalink)
Host4Cheap.org
 
Sukhdeep Singh's Avatar
 
Join Date: May 2005
Location: Digit Forum
Posts: 2,102
Default Re: Need C programme for Set operations

Here is zip of programs i made long long time back doing the same thing i guess

Set.zip
__________________
★ Want to start your Website, No worries - here is how ★
http://www.thinkdigit.com/forum/showthread.php?t=66717

★ Host4Cheap - cPanel Webhosting & Reseller Plans ★
http://www.host4cheap.org/
Sukhdeep Singh is offline   Reply With Quote
Old 21-07-2010, 09:17 PM   #4 (permalink)
Designer Here
 
techking_dinesh's Avatar
 
Join Date: Aug 2008
Location: Nashik
Posts: 396
Default Re: Need C programme for Set operations

@ARPAN:
Thanks for d algorithm. I needed the syntax. I was clear in algorithm

@Sukhdeep
Thanks a lot bro.. Totally satisfied with your help.. I will manage the symmetric difference on your syntax

And it would be great if you could share all your c programme with me. It will really help me a lot.
techking_dinesh is offline   Reply With Quote
Old 21-07-2010, 09:53 PM   #5 (permalink)
Host4Cheap.org
 
Sukhdeep Singh's Avatar
 
Join Date: May 2005
Location: Digit Forum
Posts: 2,102
Default Re: Need C programme for Set operations

Thanks a lot man...Cant share all programs..source code will get leaked lol

No just joking...actually they are quite messed up. I remember this because we were asked to make this in 4 differnt langugaes at college time and i had it in mail since we used to get this print out early morning in college campus

LOL, those where the days man
__________________
★ Want to start your Website, No worries - here is how ★
http://www.thinkdigit.com/forum/showthread.php?t=66717

★ Host4Cheap - cPanel Webhosting & Reseller Plans ★
http://www.host4cheap.org/
Sukhdeep Singh is offline   Reply With Quote
Old 25-07-2010, 01:05 PM   #6 (permalink)
Designer Here
 
techking_dinesh's Avatar
 
Join Date: Aug 2008
Location: Nashik
Posts: 396
Default Re: Need C programme for Set operations

Alrite.. No probs..

But ma college professor keeps changing the programme question

now he wants the programme to be done using functions and he wants the create set and display set option in the menu itself..... (

M Trying it out day and night ... damn
techking_dinesh is offline   Reply With Quote
Old 25-07-2010, 09:27 PM   #7 (permalink)
XLr8
 
arpanmukherjee1's Avatar
 
Join Date: Sep 2008
Posts: 637
Default Re: Need C programme for Set operations

r u new to programming ???

those things r real easy ....as a matter of fact u should be using functions to make ur code modular, regardless of the prg lang.

set display should also be seperate function.

post ur prg. , as far as u have attempted solving the question.

the real thing is the algorithm design and the data structures. if u dont get it try solving this (question of this months Linux For You <Code Chef>).

Q. How many ways r there to arrange the basic mathematical operation {+,-,*,/} in the expression 7~7~7~7~7 (~ = one operation) so that the result is 55.

NOTE: i posted a part of the question in here only, find it, i myself answered the question. bit like CRACK THE CODE
__________________
Quote:
There are more things in heaven and earth, Horatio,
Than are dreamt of in your philosophy.
arpanmukherjee1 is offline   Reply With Quote
Old 29-07-2010, 10:53 PM   #8 (permalink)
Designer Here
 
techking_dinesh's Avatar
 
Join Date: Aug 2008
Location: Nashik
Posts: 396
Default Re: Need C programme for Set operations

I ll post my programme here soon..
techking_dinesh is offline   Reply With Quote
Reply

Bookmarks

Thread Tools
Display Modes

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

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Airtel set to start operations for 3G services, successfully tested . dr_jimit Technology News 47 06-04-2008 04:30 PM
gr8 indian TV programme guide site tgpraveen Chit-Chat 7 29-11-2007 01:27 PM
Arithmetic operations in flash part_time_ch Internet & WWW 1 20-09-2007 12:44 PM
FOXPRO PROGRAMME SITE NAME REQUIRE (VER 2.6 DOS BASED RELATE dikudik Software Q&A 1 30-08-2004 10:06 PM

 
Latest Threads
- by Charan
- by Charan
- by clmlbx

Advertisement




All times are GMT +5.5. The time now is 03:20 AM.


Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2012, vBulletin Solutions, Inc.

Search Engine Optimization by vBSEO 3.3.2