English Deutsch Français Italiano Español Português 繁體中文 Bahasa Indonesia Tiếng Việt ภาษาไทย
All categories

I am programming using C++, using Microsoft Visual Studio 2005.
here are the errors:
j:\hw2\hw2a-ssabdelm.cpp(23) : error C2143: syntax error : missing ')' before ';'
j:\hw2\hw2a-ssabdelm.cpp(23) : error C2563: mismatch in formal parameter list
j:\hw2\hw2a-ssabdelm.cpp(23) : error C2100: illegal indirection
j:\hw2\hw2a-ssabdelm.cpp(23) : error C2059: syntax error : ')'
j:\hw2\hw2a-ssabdelm.cpp(23) : warning C4552: '*' : operator has no effect; expected operator with side-effect
Build log was saved at "file://c:\Documents and Settings\Sam & Jacqueline\My Documents\Visual Studio 2005\Projects\hw2-ssabdelm\hw2-ssabdelm\Debug\BuildLog.htm"
hw2-ssabdelm - 4 error(s), 1 warning(s)
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========

2007-02-12 13:30:00 · 7 answers · asked by S A 3 in Computers & Internet Programming & Design

#include
#include
#include
using namespace std;
#define pi 3.14;

int main()
{
char notat;
float vlt;
int freq = 1;
float time=0;

cout <<"Would you like your output in scientific (s) or decimal (d) notation?" < cin >> notat;


if (notat == 's')
{
cout << "You have chosen scientific notation: " << setiosflags(ios::scientific) << endl;

vlt = sin(2*pi*freq*time);
cout << vlt < }
else if (notat == 'd')
cout << "You have chosen decimal notation: " <
else

cout <<"You must enter s or d, please re-enter:" < cin >> notat;


cout <<"You have chosen "<
return 0;
}

2007-02-12 13:41:48 · update #1

7 answers

Take out the *

vlt = sin(2*pi*freq*time);

And remove the semicolon from your #define for pi (which should be upper case anyway):

#define PI 3.14

2007-02-12 13:38:21 · answer #1 · answered by Anonymous · 0 0

Well I assume you are intending to use the Sine function...

your line should read vlt = sin(2*pi*freq*time);

- you have a star (*) between sin and the opening parenthesis which I believe is causing at least some of your problems..

You may also want to make sure the other terms in your expression are correctly defined and watch out for the 2.. it will be interpreted as an integer which may cause the other terms to be truncated to integers I.E. It becomes sin( 2 * 3 * freq * time ) which I'm fairly sure is not what you want.


Hope this helps.

2007-02-12 13:40:43 · answer #2 · answered by Maniaca Esoterica 3 · 0 0

And the top of the Morning to you too lassie! A fine day here in Cali! The only thing I have researched that I would try a holistic approach to is TMJ prior to any surgical procedure. Only because I have heard some people are not thrilled with the outcome of the surgery! But yes sometimes I want to throw my hands up in the air and go holistic because I feel which ever dog at the time is under vet care is on too much medication. But I have not really had much more experience with it than that. Oh and I probably should mention none of my dogs have TMJ (thank you Jesus) I just researched when a friend of mines dog was diagnosed with it. She opted for the surgery! Not a happy camper after surgery!*;*

2016-05-24 03:33:42 · answer #3 · answered by Patricia 3 · 0 0

sin is a math function which has the following prototype:

double sin(double x);

so as an obvious syntax error its easy to see you are incorrectly adding in a '*' between sin and its parameter.

The line should have the '*' after the sin function removed in order for the parameter to be properly accepted.

vlt = sin(2*pi*freq*time);

Hope that helps.

---------------------------------------------------------------------------

You still have a problem now that you've paste the code with your preprocessor define

eg: #define pi 3.14;
used with : vlt = sin*(2*pi*freq * time);
becomes : vlt = sin*(2*3.14;*freq * time);

The semi-colon will cause a syntax error, therefore the define should not have it in there eg

#define pi 3.14

is all you need.

2007-02-12 13:43:20 · answer #4 · answered by Clip-Man 3 · 1 0

syntax error: there should be no * between sin and bracket. I t should be vlt = sin(2*pi*freq * time);

2007-02-12 13:39:03 · answer #5 · answered by Trung V 1 · 0 0

Take out the ; from in front fo the " and put it behind it.

2007-02-12 13:34:16 · answer #6 · answered by Anonymous · 0 1

I think you need to write sin(x), not sin*(x).

2007-02-12 13:43:57 · answer #7 · answered by injanier 7 · 0 0

fedest.com, questions and answers