-
October 23rd, 2012, 08:56 AM
#1
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;
}
-
October 23rd, 2012, 08:59 AM
#2
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.
-
October 23rd, 2012, 09:06 AM
#3
Re: c code convert to matlab code
which forum ??? do you respond to that code is not for you to judge.
-
October 23rd, 2012, 09:12 AM
#4
Re: c code convert to matlab code
I don't know, some kind of Matlab forum I guess.
-
October 23rd, 2012, 09:51 AM
#5
Re: c code convert to matlab code
Yep, I don't see many Matlab posts getting answered on CG.
ahoodin
To keep the plot moving, that's why.
Tags for this Thread
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|