missing parenthesis.

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • isaacr
    New Member
    • Mar 2007
    • 6

    missing parenthesis.

    hi everyone. im new here and it looks like a good place to get some help with school. basically im currently trying to write a program with c++ on a program called Turbo C_5 (i think). what i am trying to do is write a program that will print four columns each with a heading that will have field of fifteen characters. in the first column is the integer in the second is its square in the third is its cube and in the fourth is its square root. under the first line is a space and then starts the printing which should end up looking something like this:

    integer square cube square root

    1 1 1 1
    2 4 8 1.4......
    3 9 27 1.7......
    ........ ..... ... ............
    30 .... ..... .....


    until thirty. you get the picture. i wrote out the program but every time i use it i get an error message where there shouldnt be one at all. ill type up the program until after where the error message appears.

    #include <stdio.h>
    #include <math.h>
    void main()
    {
    int x;
    double y;
    triple z;............. ............... ............... im not sure this is right i dont think so but sqrt a; for lack of a better term (to my knowlege)
    printf ("%15d%15d%15d% 15d\n","integer ","double","tri ple","square root"); ...it got messy here it kept giving me on particular error message. it said something about a parenthasis missing. if anyone can help me it would be greatly appreciated.
    in humility,
    isaac
  • r035198x
    MVP
    • Sep 2006
    • 13225

    #2
    Originally posted by isaacr
    hi everyone. im new here and it looks like a good place to get some help with school. basically im currently trying to write a program with c++ on a program called Turbo C_5 (i think). what i am trying to do is write a program that will print four columns each with a heading that will have field of fifteen characters. in the first column is the integer in the second is its square in the third is its cube and in the fourth is its square root. under the first line is a space and then starts the printing which should end up looking something like this:

    integer square cube square root

    1 1 1 1
    2 4 8 1.4......
    3 9 27 1.7......
    ........ ..... ... ............
    30 .... ..... .....


    until thirty. you get the picture. i wrote out the program but every time i use it i get an error message where there shouldnt be one at all. ill type up the program until after where the error message appears.

    #include <stdio.h>
    #include <math.h>
    void main()
    {
    int x;
    double y;
    triple z;............. ............... ............... im not sure this is right i dont think so but sqrt a; for lack of a better term (to my knowlege)
    printf ("%15d%15d%15d% 15d\n","integer ","double","tri ple","square root"); ...it got messy here it kept giving me on particular error message. it said something about a parenthasis missing. if anyone can help me it would be greatly appreciated.
    in humility,
    isaac
    Post the full code you have used for this.

    P.S. Next time choose a title that best describes your problem.

    Comment

    • DumRat
      New Member
      • Mar 2007
      • 93

      #3
      Originally posted by isaacr
      hi everyone. im new here and it looks like a good place to get some help with school. basically im currently trying to write a program with c++ on a program called Turbo C_5 (i think). what i am trying to do is write a program that will print four columns each with a heading that will have field of fifteen characters. in the first column is the integer in the second is its square in the third is its cube and in the fourth is its square root. under the first line is a space and then starts the printing which should end up looking something like this:

      integer square cube square root

      1 1 1 1
      2 4 8 1.4......
      3 9 27 1.7......
      ........ ..... ... ............
      30 .... ..... .....


      until thirty. you get the picture. i wrote out the program but every time i use it i get an error message where there shouldnt be one at all. ill type up the program until after where the error message appears.

      #include <stdio.h>
      #include <math.h>
      void main()
      {
      int x;
      double y;
      triple z;............. ............... ............... im not sure this is right i dont think so but sqrt a; for lack of a better term (to my knowlege)
      printf ("%15d%15d%15d% 15d\n","integer ","double","tri ple","square root"); ...it got messy here it kept giving me on particular error message. it said something about a parenthasis missing. if anyone can help me it would be greatly appreciated.
      in humility,
      isaac

      The problem is with the variable declarations. That is, you denote an integer in c++ by the keyword 'int'. There is also a variable type called 'double' which can hold fractional numbers like 1.41, etc. But int cannot hold these. It can hold only full numbers. So, if u say

      Code:
      int x;
      that means that x can hold any integer value from -2^16 to 2^16 - 1. But it cannot hold 1.4 for example.
      But say,

      Code:
      double y;
      and y can now hold 1.4 as well as 2 and 3 and 4.5 and so on.

      But, there is no variable type of 'triple' or 'sqrt'. U have misunderstood something there.

      so, if u'd want to get the square of 8, u can write something like this.

      Code:
      int x;
      x = 8;
      int y;
      y = pow(x, 2);
      pow(a, b) returns a^b.

      So, you get 64 for y. Then all you have to do is print that out.

      but if u want to get the square root

      Code:
      int x;
      x = 8;
      double y;
      y = sqrt(x);
      Then u will have to print out y.

      But I think u will have to refer to a basic lesson in c++. They are abundant on the web. that will get u updated on printing these values on the monitor. best of luck!
      Last edited by horace1; Mar 9 '07, 07:39 AM. Reason: fixed code tags

      Comment

      Working...