CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
+ Reply to Thread
Results 1 to 5 of 5
  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 GCDEF has a reputation beyond repute (3000+) GCDEF has a reputation beyond repute (3000+) GCDEF has a reputation beyond repute (3000+) GCDEF has a reputation beyond repute (3000+) GCDEF has a reputation beyond repute (3000+) GCDEF has a reputation beyond repute (3000+) GCDEF has a reputation beyond repute (3000+) GCDEF has a reputation beyond repute (3000+) GCDEF has a reputation beyond repute (3000+) GCDEF has a reputation beyond repute (3000+) GCDEF has a reputation beyond repute (3000+)
    Join Date
    Nov 2003
    Posts
    11,563

    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 GCDEF has a reputation beyond repute (3000+) GCDEF has a reputation beyond repute (3000+) GCDEF has a reputation beyond repute (3000+) GCDEF has a reputation beyond repute (3000+) GCDEF has a reputation beyond repute (3000+) GCDEF has a reputation beyond repute (3000+) GCDEF has a reputation beyond repute (3000+) GCDEF has a reputation beyond repute (3000+) GCDEF has a reputation beyond repute (3000+) GCDEF has a reputation beyond repute (3000+) GCDEF has a reputation beyond repute (3000+)
    Join Date
    Nov 2003
    Posts
    11,563

    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,353

    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.

+ Reply to Thread

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts



HTML5 Development Center

Click Here to Expand Forum to Full Width