c code convert to matlab code
CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 5 of 5

Thread: c code convert to matlab code

  1. #1
    Join Date
    Oct 2012
    Posts
    2

    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;

    }

  2. #2
    GCDEF is offline Elite Member Power Poster
    Join Date
    Nov 2003
    Posts
    12,098

    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.

  3. #3
    Join Date
    Oct 2012
    Posts
    2

    Re: c code convert to matlab code

    which forum ??? do you respond to that code is not for you to judge.

  4. #4
    GCDEF is offline Elite Member Power Poster
    Join Date
    Nov 2003
    Posts
    12,098

    Re: c code convert to matlab code

    I don't know, some kind of Matlab forum I guess.

  5. #5
    Join Date
    Mar 2001
    Posts
    2,366

    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
  •  


Windows Mobile Development Center


Click Here to Expand Forum to Full Width

This is a CodeGuru survey question.


Featured


HTML5 Development Center