473,385 Members | 1,848 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

My C++ code is not running any numbers ???

I have no idea why this is not giving me any numbers.
It is supposed to be reading x=__ y=___ but instead it is only giving me my first cout .

Expand|Select|Wrap|Line Numbers
  1. //Imani Jones' Output of Her First Program
  2. #include <iostream>
  3. #include <cmath> 
  4. using namespace std;
  5. int main () 
  6. {
  7.     cout<<"My name is Imani Jones and this is the output of my first program."<<endl<<endl;
  8.     double x, y;
  9.  
  10.         for (x=-3.5;x=3;x=x+0.5) 
  11.     { y=((-4*x)*x*x+(4*x)*x+(25*x)-25)/ ((sqrt(4*x)*x+2)+3*  abs(x+1.5));
  12.  
  13.     if (x<0)
  14.     cout<<" Y is negative "<<endl;
  15.     if (x==0) 
  16.     cout<< "Y is positive "<<endl;
  17.     if (x>0)
  18.     cout<< "Y is positive "<<endl<<endl;
  19.     } 
  20.  
  21.    std::cout <<"My First Program is Complete"<< std::endl; 
  22.    system ("pause");
  23.  return 0; 
  24. }
Feb 6 '12 #1
3 1557
Just pointing this out: for(x=-3.5;x=3;x=x+0.5)

With x being assigned 3, then the condition for the loop will always equal TRUE and will never end.
Feb 6 '12 #2
Rabbit
12,516 Expert Mod 8TB
Also, you shouldn't use floats for comparisons. They're not accurate.
Feb 6 '12 #3
whodgson
542 512MB
apart from fixing the loop where does your code instruct the print out of x and y?
Feb 6 '12 #4

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

Similar topics

9
by: leke | last post by:
Hi, I am trying to learn PHP but am having some problems getting my code running in Explorer 6. <html> <head> <title>PHP Test</title> </head> <body> <?php echo '<p>Hello World</p>'; ?>...
3
by: Serg | last post by:
I need to do some caching. If my code is running a part of asp.net then I would use caching, otherwise I'll just store my data in an object. And my question is now do I determine at run time if...
2
by: Scott McNair | last post by:
I've got an app I'm writing that has logic like this: 1. Check the database. If any of the items on List X are already in there, post an error stating which items are duplicates. 2. Add the...
0
by: Micela | last post by:
Hi, Could any one help me to generate running numbers by default whenever i load a page. Like V_0000001 V_0000002 ..... and when it reaches a limit should again start with V_0000001... the field...
2
by: akantrowitz | last post by:
I have a asp.net 2.0 page that runs a large DB query on the Page_Load event. This is needed because it generates an array of pictures that are then dumped out onto the webpage. Is there any way...
1
by: BobVDP | last post by:
My statement print "Set-Cookie: name=value;" started printing out to the browser instead of setting the cookie. I am running PERL on a IIS6 Server. I must have changed a setting on IIS but I can't...
3
by: Mark | last post by:
Hi All, I have wrote a sub to record events from within the database. A lot of these events are errors. The sub has the module name and function/sub name passed to it to record to the table. My...
7
by: ashjas | last post by:
Hello, I have run this logic on turboc++ 3.0 and it is working fine on it but its not running on msvs2008 c++. i am not able to assign the value like this *temp=*main,where main and temp are char...
1
by: sithynoan | last post by:
Dear all, I do want to know how can we code to run many program at the same time?If you have any idea pls email me those code to my address : .I hope to get this valueable solution soon.Thanks to...
14
by: anchitgood | last post by:
Hey, I have developed the following code and it is executing well on windows. But I don't have LINUX installed on my system. I would be grateful to you guys if you check whether this code is...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
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
1
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...
0
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...
0
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...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.