Hello i can't find the error on my program..and i dont know how to end it either. - #include<iostream>
-
#include<iomanip>
-
#include<iomanip>
-
#include<cmath>
-
#include<string>
-
using namespace std;
-
-
void falsi(double& fd, double& fu, double& fr, double d, double u, double r)
-
{
-
fd=sin(d)+cos(1+d*d)-1;
-
fu=sin(u)+cos(1+u*u)-1;
-
r=((u*fd - d*fu) / (fd - fu));
-
fr=sin(r)+cos(1+r*r)-1;
-
}
-
-
void eq(double x, double y)
-
{
-
int i;
-
double fd,fu,fr,u,d,r;
-
x*=1;
-
y*=1;
-
cout<<"The value of Xd=1 and Xu=2\n";
-
for (i=4;i<5;i++)
-
{
-
falsi(fd,fu,fr,d,u,r);
-
if (fr > 0 && fd > 0)
-
{
-
r = d;
-
}
-
else
-
{
-
r = u;
-
}
-
-
int main()
-
{
-
char z;
-
cout<<"choose letter a, b, or c";
-
cin>>z;
-
if (z=='a')
-
{
-
eq(1,2);
-
}
-
else if (z=='b')
-
{
-
eq(1,2.5);
-
}
-
else
-
{
-
eq(1,1.5);
-
}
4 1095
Hello i can't find the error on my program..and i dont know how to end it either.
#include<iostream>
#include<iomanip>
#include<iomanip>
#include<cmath>
#include<string>
using namespace std;
void falsi(double& fd, double& fu, double& fr, double d, double u, double r)
{
fd=sin(d)+cos(1+d*d)-1;
fu=sin(u)+cos(1+u*u)-1;
r=((u*fd - d*fu) / (fd - fu));
fr=sin(r)+cos(1+r*r)-1;
}
void eq(double x, double y)
{
int i;
double fd,fu,fr,u,d,r;
x*=1;
y*=1;
cout<<"The value of Xd=1 and Xu=2\n";
for (i=4;i<5;i++)
{
falsi(fd,fu,fr,d,u,r);
if (fr > 0 && fd > 0)
{
r = d;
}
else
{
r = u;
}
int main()
{
char z;
cout<<"choose letter a, b, or c";
cin>>z;
if (z=='a')
{
eq(1,2);
}
else if (z=='b')
{
eq(1,2.5);
}
else
{
eq(1,1.5);
}
I don't understand why you define in falsi fd and others to be a reference to a double, but then use them in the same way a the normal doubles d, u, r.
Also what is the sense of x*=1 and y*=1? You don't change anything...
Hello i can't find the error on my program..and i dont know how to end it either.
#include<iostream>
#include<iomanip>
#include<iomanip>
#include<cmath>
#include<string>
using namespace std;
void falsi(double& fd, double& fu, double& fr, double d, double u, double r)
{
fd=sin(d)+cos(1+d*d)-1;
fu=sin(u)+cos(1+u*u)-1;
r=((u*fd - d*fu) / (fd - fu));
fr=sin(r)+cos(1+r*r)-1;
}
void eq(double x, double y)
{
int i;
double fd,fu,fr,u,d,r;
x*=1;
y*=1;
cout<<"The value of Xd=1 and Xu=2\n";
for (i=4;i<5;i++)
{
falsi(fd,fu,fr,d,u,r);
if (fr > 0 && fd > 0)
{
r = d;
}
else
{
r = u;
}
int main()
{
char z;
cout<<"choose letter a, b, or c";
cin>>z;
if (z=='a')
{
eq(1,2);
}
else if (z=='b')
{
eq(1,2.5);
}
else
{
eq(1,1.5);
}
HI,
please post the code with code tags which will be easier for us to read/understand the code.
You have couple of } missed.
Try to use a editor like notepad++ which helps u in finding this.
Raghuram
What do you suggest i do?this is btw false position method for approximating a root.
The only syntax errors I noted were that you never finished the eq() function - there are a few }'s missing - and you also didn't finish the main() function in the same manner.
Sign in to post your reply or Sign up for a free account.
Similar topics
by: mike420 |
last post by:
I think everyone who used Python will agree that its syntax is
the best thing going for it. It is very readable and easy
for everyone to learn. But, Python does not a have very good
macro...
|
by: mike420 |
last post by:
In the context of LATEX, some Pythonista asked what the big
successes of Lisp were. I think there were at least three *big*
successes.
a. orbitz.com web site uses Lisp for algorithms, etc.
b....
|
by: Moosebumps |
last post by:
Does anyone here find the list comprehension syntax awkward?
I like it because it is an expression rather than a series of statements,
but it is a little harder to maintain it seems.
e.g. you...
|
by: Steven Bethard |
last post by:
I think one of the biggest reasons we're having such problems coming
to any agreement on decorator syntax is that each proposal makes a
number of syntax decisions, not just one. For decorators, I...
|
by: shank |
last post by:
1) I'm getting this error: Syntax error (missing operator) in query
expression on the below statement. Can I get some advice.
2) I searched ASPFAQ and came up blank. Where can find the "rules"...
|
by: Dave |
last post by:
I have 2 tables, one with names, and another with addresses, joined by their
CIVICID number (unique to the ADDRESSINFO table) in Oracle.
I need to update a field in the NAMEINFO table for a...
|
by: Berthold Höllmann |
last post by:
I have a default coding header
# -*- coding: iso-8859-15 -*-
in my python files. I now have Problems with this settings. I
swithched to Python 2.4.1 under Windows. When I import files with the...
|
by: tom |
last post by:
I am new to SQL administration.
>From a list of IDs that are the primary key in one table (i.e. Customer
Table), I want to make changes in tables that use those IDs as a
foreign key.
...
|
by: C# Learner |
last post by:
Why is C syntax so uneasy on the eye?
In its day, was it _really_ designed by snobby programmers to scare away
potential "n00bs"? If so, and after 50+ years of programming research,
why are...
|
by: Rick Strahl [MVP] |
last post by:
I seem to have problems when working with large Windows Forms files. What
happens is that hte editor looses its syntax color highlighting and
Intellisense capability on large files. The code works...
|
by: emmanuelkatto |
last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud.
Please let me know.
Thanks!
Emmanuel
|
by: BarryA |
last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
|
by: Sonnysonu |
last post by:
This is the data of csv file
1 2 3
1 2 3
1 2 3
1 2 3
2 3
2 3
3
the lengths should be different i have to store the data by column-wise with in the specific length.
suppose the i have to...
|
by: Hystou |
last post by:
There are some requirements for setting up RAID:
1. The motherboard and BIOS support RAID configuration.
2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
|
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers,...
|
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
| |