pc_math
دوشنبه 05 آذر 1386, 21:51 عصر
مشکل این برنامه چیه:
برنامه ای که عبارتی ریاضی را گرفته و بین عملگر و عملوند ها فاصله ایجاد و چاپ نماید:(از دستور break هم استفاده کردیم).
#include <mem.h>
#include <iostream.h>
#include <conio.h>
#include <string.h>
int main()
{
char s1[51];
int n;
char s2[10]={'=','-','+','*','/','(',')','^','\0'};
cout<<"Enter your string:";
cin.get(s1,50);
n=strlen(s1);
for(int i=0; i<= n; i++)
for(int j=0; j< 9; j++){
if(s1[i] == s2[j]){
cout<<" ";
cout<<s2[j];
cout<<" ";
}//end of if
else
cout<<s1[i];
}// end of second for
getch();
return 0;
}
:خجالت::خجالت::متفکر:
برنامه ای که عبارتی ریاضی را گرفته و بین عملگر و عملوند ها فاصله ایجاد و چاپ نماید:(از دستور break هم استفاده کردیم).
#include <mem.h>
#include <iostream.h>
#include <conio.h>
#include <string.h>
int main()
{
char s1[51];
int n;
char s2[10]={'=','-','+','*','/','(',')','^','\0'};
cout<<"Enter your string:";
cin.get(s1,50);
n=strlen(s1);
for(int i=0; i<= n; i++)
for(int j=0; j< 9; j++){
if(s1[i] == s2[j]){
cout<<" ";
cout<<s2[j];
cout<<" ";
}//end of if
else
cout<<s1[i];
}// end of second for
getch();
return 0;
}
:خجالت::خجالت::متفکر: