c code convert to matlab code
I'm trying to understand and learn the matlab language, and since I used to work in c code, I'm interested in knowing how this code would be converted into matlab code..I need your help urgent friends..Need to do this project until tomorrow. my e-mail address alp.eren.1990 @ hotmail.com
enter code here
int main ()
{
int a;
float f;
double g;
a=100;
f=3.14159;
g=3.14592;
printf("a=%d\n",a);
printf("a=%-10d\n",a);
printf("f=%f\n",f);
printf("f=%-10.5f,\n");
}
enter code here
i=1; k=1; m=1;
m+=++i +k++;
printf("%d,%d,%d",i,k,m);
enter code here
sayi=0;
while(sayi!=9)
{
sayi+=3;
printf("%d\n",sayi);
}
enter code here
int main()
{
int a,b,i=0,j,k,f;
printf("Enter a integer\n");
scanf("%d",&a);
printf("\n");
b=2*a-1;
if(a<=0)
printf("Enter the false value!\n);
else
for(j=0;j<a;j++)
{
if(i==0)
{
k=(b-1)/2;
f=(b+1)/2;
}
for(i=0;i<b;i++)
{
if((i<k) '' (i>=f && i<=b))
printf(" ");
else printf("*");
}
k--;
f++;
printf("\n");
}
}
enter code here
int main()
{
int i,j;
for(i=0;i<5;i++)
{
for(j=0;j<i+1;j++)
{
printf("*");
}
printf("\n");
}
enter code here`
int main()
{
int i=0,j;
while(i<5){
j=0;
while(j<i+1){
printf("*");
j++;
}
printf("*");
i++;
}
enter code here
{
int main()
int i,j;
for(i=0;i<5;i++)
{
for(j=0;j<i+1;j--)
{
printf("*");
}
printf("\n");
}
enter code here
int main()
{
int i=0,j;
while(j<i+1)
{
printf("*");
j++;
}
printf("\n");
i++;
return 0;
}
Re: c code convert to matlab code
This is a Visual C++ forum, not a C or matlab forum
How about using code tags and formatting your code in a readable format when you do post in the right forum. What's with all the blank lines?
Even for C, the code doesn't make sense. You can't have multiple main functions for example.
Re: c code convert to matlab code
which forum ??? do you respond to that code is not for you to judge.
Re: c code convert to matlab code
I don't know, some kind of Matlab forum I guess.
Re: c code convert to matlab code
Yep, I don't see many Matlab posts getting answered on CG.