function 'system' shuld have prototype.

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • saud king
    New Member
    • Jan 2015
    • 1

    #1

    function 'system' shuld have prototype.

    Kindly help me i want to submite a project tommorow . . .
    why shoul its come every tyme . . . fuction 'system' should have prototype
    Attached Files
  • Ajay Bhalala
    New Member
    • Nov 2014
    • 119

    #2
    Can you provide me your full c++ code?

    Comment

    • weaknessforcats
      Recognized Expert Expert
      • Mar 2007
      • 9214

      #3
      Anytime you make a function call the compiler has to know what arguments are required and what the return value is. Otherwise, the compiler can't check to see if you are using the function correctly.

      If the function is not coded in the file being compiled then you need a function prototype.

      Al you need do here is #include the header file that contains the function prototype of the system function.

      Comment

      • donbock
        Recognized Expert Top Contributor
        • Mar 2008
        • 2427

        #4
        In standard C, that header file is stdlib.h.

        Comment

        • HashimJVZ
          New Member
          • Feb 2018
          • 1

          #5
          Magic

          Originally posted by Ajay Bhalala
          Can you provide me your full c++ code?
          #include<iostre am.h>
          #include<conio. h>
          void main()
          {clrscr();
          int sum=0;char x;
          cout<<"Think of a no: from 1-50\n";
          cout<<" 01 02 03\n"
          <<"01 03 05 07 09 02 03 06 07 10 04 05 06 07 12\n"
          <<"11 13 15 17 19 11 14 15 18 19 13 14 15 20 21\n"
          <<"21 23 25 27 29 22 23 26 27 30 22 23 28 29 30\n"
          <<"31 33 35 37 39 31 34 35 38 39 31 36 37 38 39\n"
          <<"41 43 45 47 49 42 43 46 47 50 44 45 46 47\n\n"
          <<" 04 05 06\n"
          <<"08 09 10 11 12 16 17 18 19 20 32 33 34 35 36\n"
          <<"13 14 15 25 26 21 22 23 24 25 37 38 39 40 41\n"
          <<"27 28 29 30 31 26 27 28 29 30 42 43 44 45 46\n"
          <<"32 41 42 43 44 31 48 49 50 47 48 49 50\n"
          <<"45 46 47\n";
          cout<<"Answer the following questions with y/n & Press Enter\n";
          cout<<"Q) Is the number present in 1st box?\n";
          cin>>x;
          if(x=='y')
          sum=sum+1;
          cout<<"Q) Is the number present in 2nd box?\n";
          cin>>x;
          if(x=='y')
          sum=sum+2;
          cout<<"Q) Is the number present in 3rd box?\n";
          cin>>x;
          if(x=='y')
          sum=sum+4;
          cout<<"Q) Is the number present in 4th box?\n";
          cin>>x;
          if(x=='y')
          sum=sum+8;
          cout<<"Q) Is the number present in 5th box?\n";
          cin>>x;
          if(x=='y')
          sum=sum+16;
          cout<<"Q) Is the number present in 6thbox?\n";
          cin>>x;
          if(x=='y')
          sum=sum+32;
          cout<<"The number is "<<sum;
          cout<<"\nCreate d by Muhammed Hashim";
          getch();
          }

          Comment

          • weaknessforcats
            Recognized Expert Expert
            • Mar 2007
            • 9214

            #6
            What is your question now?

            Did you:

            Code:
            using namespace std;
            before main? Your example on your first post has name space rather than namespace.

            Comment

            Working...