Hi what is wrong with thiss code

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • kol

    #1

    Hi what is wrong with thiss code

    visual c++ samples , algorithm ,collection of array, if statement , mod operator ,class samples

    this code\\


    #include <cstdlib>
    #include <iostream>

    using namespace std;

    void const pring(const int r){
    r++; ;

    cout <<"R IS " << r<<endl;
    }

    int main(int argc, char *argv[])
    {
    const int b = 5;
    pring(b);

    system("PAUSE") ;
    return EXIT_SUCCESS;
    }

  • Andre Kostur

    #2
    Re: Hi what is wrong with thiss code

    kol <hawash2@gmail. comwrote in news:1183579126 .682925.36940
    @w5g2000hsg.goo glegroups.com:
    #include <cstdlib>
    #include <iostream>
    >
    using namespace std;
    >
    void const pring(const int r){
    r++; ;
    >
    cout <<"R IS " << r<<endl;
    }
    >
    int main(int argc, char *argv[])
    {
    const int b = 5;
    pring(b);
    >
    system("PAUSE") ;
    return EXIT_SUCCESS;
    }
    >
    >

    Why? What do you think is wrong? Have you tried to compile it and see
    what happens?

    Comment

    • Victor Bazarov

      #3
      Re: Hi what is wrong with thiss code

      "kol" <hawash2@gmail. comwrote...
      visual c++ samples , algorithm ,collection of array, if statement , mod operator ,class samples

      this code\\
      >
      >
      #include <cstdlib>
      #include <iostream>
      >
      using namespace std;
      >
      void const pring(const int r){
      r++; ;
      'r' is constant in the context of this function. You can't use anything
      that needs to be able to change 'r's value.
      >
      cout <<"R IS " << r<<endl;
      }
      >
      int main(int argc, char *argv[])
      {
      const int b = 5;
      pring(b);
      >
      system("PAUSE") ;
      return EXIT_SUCCESS;
      }
      >
      >
      V
      --
      Please remove capital A's from my address when replying by mail


      Comment

      Working...