تبلیغات
دانلود سورس پروژه های مختلف برنامه نویسی، آموزش برنامه نویسی - سورس کد جدول کارنو در سی پلاس پلاس
دانلود سورس پروژه های مختلف برنامه نویسی، آموزش برنامه نویسی
دانلود رایگان سورس پروژه
سایت برنامه نویسی تک کدر takcoder.ir


آموزش برنامه نویسی با استفاده از نوین ترین روش و ارائه پروژه های نمونه و مجموعه عظیم سورس کدهای آماده برای شما دوستان

مدیر سایت : Yahya Taherzadeh
نویسندگان
نظرسنجی
زبان برنامه نویسی مورد علاقه شما؟






سورس کد جدول کارنو به زبان c++ که سال پیش  با یکی دوستام پیاده کرده بودیم، هم اکنون در اختیار شما دوستان قرار می دهم.
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
int main(void)
{ int b[20][20],c[20][20],n,*m,*ones,*primes,i,j,k,e,f,t;
int a1,b1,index,min = 0,order=0,cnt=0;
char cr;
printf(” Section: 4 \n”);
printf(” Bench No. : 23777 \n”);
printf(“\n enter # of variables in boolean expr. : “);
scanf(“%d”,&n);
if (n<=0) { printf(” error : not valid no. of variables \n”); goto end; }
m=(int *)calloc(n,sizeof(int));
ones=(int *)calloc(n,sizeof(int));
primes=(int *)calloc(n,sizeof(int));
printf(“\n enter minterms seperated by space”);
printf(“\n note : enter last minterm -1″);
printf(“\n for example  F(x1,x2,x3)=(0,1,2,7) is entered as “);
printf(“\n 0 1 2 7 -1 “);
printf(“\n enter data : “);
for (i=0;i<pow(2,n);++i)
{ scanf(“%d”,&m[i]);
if (m[i]==-1)
break;
if ((m[i]>=pow(2,n)) || (m[i]<0))
{
printf(“\n error : %d not a valid minterm.\n”,m[i]);
printf(” please re-run the program \n “);
goto end;
}
for (j=n-1;j>=0;–j)
{ b[i][j]=((m[i]%2)==1); m[i]/=2; }
}
printf(“\n\n Displaying minterm’s binary values of entered function\n”);
for (k=0;k<i;++k)
{ printf(” | “);
for (j=0;j<n;++j)
printf(“%d”,b[k][j]);
}
printf(“\n press enter to continue “);
cr=getchar();
cr=getchar();
printf(“\n\n Displaying the function before simplification : “);
printf(” \n F(“);
for (k=1;k<=n;++k)
printf(“x%d%s”,k,(k!=n)?”,”:”)”);
printf(“=”);
for (k=0;k<i;++k)
{    for (j=0;j<n;++j)
if (b[k][j]==0)
printf(“x%d’”,j+1);
else if (b[k][j]==1)
printf(“x%d”,j+1);
printf(“%s”,(k==i-1)?”.\n”:” + “);
}
printf(“\n press enter to continue “);
cr=getchar();
for (k=0;k<i;++k)
primes[k]=0;
for (f=0;f<i;++f)
{
for (k=0;k<i;++k)
{ ones[k]=0; primes[k]=0;}
for (k=0;k<i;++k)
for (j=0;j<n;++j)
ones[k]+=(b[k][j]==1);
of next level of ones. */
min=ones[0];
for (k=0;k<i;++k)
min=(ones[k]<=min)?ones[k]:min;
for (e=0;e<i;++e)
for (k=0;k<i;++k)
if (ones[k]==min+e)
for (j=0;j<i;++j)
{     if (j==k) continue;
if (ones[j]==min+e+1)
{    for (a1=0;a1<n;a1++)
if  (b[k][a1]==b[j][a1])
++cnt;
else
index=a1;
if (cnt==n-1)
{    primes[k]=1;
primes[j]=1;
for (b1=0;b1<n;b1++)
if (b1==index)
c[order][b1]=’-';
else
c[order][b1]=b[k][b1];
++order;
}
}
cnt=0;
}
for  (k=0;k<order;k++)
for (j=0;j<n;j++)
b[k][j]=c[k][j];
}
t=0;
for (k=0;k<order;++k)
if (primes[k]==0)
{ for (j=0;j<n;++j)
c[t][j]=b[k][j];
++t;
}
printf(“\n Displaying the binary value of the functions prime implicants \n”);
for (k=0;k<t;++k)
{ printf(” \n”);
for (j=0;j<n;++j)
if (c[k][j]==45)
printf(“%c”,c[k][j]);
else
printf(“%d”,c[k][j]);
}
printf(“\n press enter to continue “);
cr=getchar();
printf(“\n Displaying the function after simplification : “);
printf(” \n F(“);
for (k=1;k<=n;++k)
printf(“x%d%s”,k,(k!=n)?”,”:”)”);
printf(“=”);
for (k=0;k<=t;++k)
{    for (j=0;j<n;++j)
if (c[k][j]==0)
printf(“x%d’”,j+1);
else if (c[k][j]==1)
printf(“x%d”,j+1);
printf(“%s”,(k==t)?”.\n”:” + “);
}
putchar(‘\n’);
end:
printf(“\n press enter to exit the program “);
cr=getchar();
return 0;
}




نوع مطلب : آموزش، پروژه های رایگان، سی| سی پلاس پلاس، پروژه های تکمیل شده، 
برچسب ها : سورس کد جدول کارنو در سی پلاس پلاس، جدول کارنو، سورس کد جدول کارنو در سی پلاس، سورس، دانلود رایگان سورس کد جدول کارنو در سی پلاس پلاس، سورس کد جدول کارنو در سی، جدول،
لینک های مرتبط :
Yahya Taherzadeh
چهارشنبه 20 آذر 1392
پنجشنبه 26 مهر 1397 02:55 ب.ظ
Amazing blog! Is your theme custom made or did you download
it from somewhere? A design like yours with a few simple adjustements would really make my
blog shine. Please let me know where you got your theme. Many thanks
پنجشنبه 19 مهر 1397 12:32 ب.ظ
Really when someone doesn't be aware of then its up to other people that they will help, so here it happens.
شنبه 14 مهر 1397 03:47 ق.ظ
Great delivery. Outstanding arguments. Keep up the great work.
جمعه 13 مهر 1397 12:10 ب.ظ
I am really impressed together with your writing talents as well as with the structure in your blog.
Is this a paid subject matter or did you customize it your self?
Anyway keep up the excellent high quality writing, it is rare to see a nice blog like this one today..
پنجشنبه 12 مهر 1397 09:00 ب.ظ
Keep on writing, great job!
دوشنبه 10 اردیبهشت 1397 03:03 ب.ظ
Its such as you read my mind! You appear to
know a lot approximately this, like you wrote the guide in it or something.
I believe that you simply could do with a few p.c.

to force the message home a bit, however instead of that, that is magnificent
blog. An excellent read. I will certainly be back.
یکشنبه 26 شهریور 1396 04:11 ب.ظ
I do not even know how I ended up here, but I thought
this post was good. I do not know who you are but
definitely you're going to a famous blogger
if you are not already ;) Cheers!
جمعه 6 مرداد 1396 08:02 ب.ظ
Good day! I know this is kind of off topic but I was wondering which blog platform are you using for
this site? I'm getting sick and tired of Wordpress because I've had issues with hackers
and I'm looking at options for another platform. I would be fantastic if you could point me
in the direction of a good platform.
سه شنبه 13 تیر 1396 03:18 ق.ظ
Hello my friend! I wish to say that this article is amazing, great
written and include approximately all vital infos.
I'd like to see more posts like this.
دوشنبه 12 تیر 1396 10:59 ق.ظ
Since the admin of this web site is working, no question very soon it will
be well-known, due to its quality contents.
یکشنبه 11 تیر 1396 09:27 ق.ظ
Glad to be one of the visitants on this awesome website :D.
پنجشنبه 1 تیر 1396 12:14 ق.ظ
Glad to be one of the visitants on this amazing website :D.
جمعه 26 خرداد 1396 08:38 ب.ظ
Wonderful web site. Lots of useful info here.
I'm sending it to a few buddies ans also sharing in delicious.
And of course, thank you to your sweat!
جمعه 12 خرداد 1396 12:50 ب.ظ
Hi! I know this is somewhat off-topic however I needed to ask.
Does operating a well-established blog such as yours require a large amount of work?
I'm completely new to operating a blog however I do write in my diary daily.
I'd like to start a blog so I can share my personal experience and views online.
Please let me know if you have any kind of recommendations
or tips for new aspiring blog owners. Appreciate it!
چهارشنبه 13 اردیبهشت 1396 07:45 ق.ظ
It's going to be ending of mine day, however before ending I am reading this fantastic
article to improve my knowledge.
جمعه 1 اردیبهشت 1396 01:17 ب.ظ
I have read so many articles concerning the blogger lovers except
this post is really a fastidious post, keep it up.
شنبه 1 اسفند 1394 03:15 ب.ظ
سلام
خسته نباشید میشه روش کار با نرم افزار را بگید
 
لبخندناراحتچشمک
نیشخندبغلسوال
قلبخجالتزبان
ماچتعجبعصبانی
عینکشیطانگریه
خندهقهقههخداحافظ
سبزقهرهورا
دستگلتفکر




صفحات جانبی
آمار وبلاگ
تاییدیه پرداخت
تبلیغات
به سایت تک کدر خوش آمدید