By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
446,131 Members | 2,055 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 446,131 IT Pros & Developers. It's quick & easy.

missing parenthesis.

P: 7
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","triple", "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
Mar 9 '07 #1
Share this Question
Share on Google+
2 Replies


10K+
P: 13,264
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","triple", "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.
Mar 9 '07 #2

P: 93
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","triple", "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

Expand|Select|Wrap|Line Numbers
  1.  
  2. int x;
  3.  
  4.  
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,

Expand|Select|Wrap|Line Numbers
  1.  
  2. double y;
  3.  
  4.  
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.

Expand|Select|Wrap|Line Numbers
  1.  
  2. int x;
  3. x = 8;
  4. int y;
  5. y = pow(x, 2);
  6.  
  7.  
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

Expand|Select|Wrap|Line Numbers
  1.  
  2. int x;
  3. x = 8;
  4. double y;
  5. y = sqrt(x);
  6.  
  7.  
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!
Mar 9 '07 #3

Post your reply

Sign in to post your reply or Sign up for a free account.