473,770 Members | 1,779 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Please could someone fix my code

16 New Member
Expand|Select|Wrap|Line Numbers
  1. #include <iostream>
  2.  
  3. void sizeYear(double,double,double ,int);
  4.  
  5. using namespace std;
  6.  
  7. int main()
  8. {
  9.  
  10.    double population;
  11.    double birthRate;
  12.    double deathRate;
  13.  
  14.    int numYears;
  15.  
  16.    cout << "Please enter a Population" << endl;
  17.    cin >> population;
  18.  
  19.    cout << "Please enter the Birth rate" << endl;
  20.    cin >> birthRate;
  21.  
  22.    cout << "Please enter a Death rate" << endl;
  23.    cin >> deathRate;
  24.  
  25.    cout << "Please enter the number of years to display" << endl;\
  26.    cin >> numYears;
  27.  
  28.    sizeYear(population,birthRate,deathRate,numYears);
  29.  
  30.    while (numYears = 0)
  31.    {
  32.       if (numYears>0) population=1;
  33.       else
  34.          population=0;
  35.    }
  36.    return 0;
  37. }


ok this is what i have came up with so far it should work but i have some errors could someone twink it a little
Apr 25 '07 #1
3 1552
Greatness
16 New Member
g2.obj : error LNK2019: unresolved external symbol "void __cdecl sizeYear(double ,double,double, int)" (?sizeYear@@YAX NNNH@Z) referenced in function _main


that is the only error i am getting
Apr 25 '07 #2
Ganon11
3,652 Recognized Expert Specialist
Have you included a definition of sizeYears() yet?
Apr 25 '07 #3
ilikepython
844 Recognized Expert Contributor
Expand|Select|Wrap|Line Numbers
  1.    while (numYears = 0)
  2.    {
  3.       if (numYears>0) population=1;
  4.       else
  5.          population=0;
  6.    }
  7.    return 0;
  8. }
ok this is what i have came up with so far it should work but i have some errors could someone twink it a little
You have while numYears = 0;. You want while numYears == 0;.
Also, I don't really get what you are trying to do with that loop. You are saying loop while numYears is equal to 0. Then, you check if numYears is greater than 0. It can't be both, so that if will never evaluate true. Also, the loop will run forever because you never change numYears so it will always be equal to 0.
Apr 25 '07 #4

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

Similar topics

13
1617
by: Chiller | last post by:
I'm now getting close to finishing my Distance class. In the code below I have included a number of overload operators that test for equality etc. I've also added more code in the TEST_DISTANCE driver to test the code. I now have 2 remaining problems: 1. The code will allow for the input of distances in either cm, m or km values; however, it isn't smart enough to convert values of different types (ie cm and km) for correct follow on...
8
1767
by: kittykat | last post by:
Hi, could someone please check my code? its asking the user to enter 3 letters, and check to see if these letters exist in the text file. i know ive done something wrong. can someone fix my code please?? #include <fstream> #include <string> #include<iomanip> #include <iostream> #include<istream>
5
2063
by: TrvlOrm | last post by:
HI There, I have been struggling with JavaScript code for days now, and this is my last resort! Please help... I am trying to create a JavaScript slide show with links for Next Slide, Previous Slide and Home Slide. Is it possible for you to view my page and tell me what I am doing wrong. I have looked at this page for hours and can't figure it out, I
11
1926
by: milkyway | last post by:
Hello, I have an HTML page that I am trying to import 2 .js file (I created) into. These files are: row_functions.js and data_check_functions.js. Whenever I bring the contents of the files into this HTML file, all is OK but whenever the functions are separated (as it is now), when I run the page, I get the following error: Line 73, object expected.
5
1443
by: jalkadir | last post by:
Can someone please explain to me why, if I type 'Ni(ALT-164)A' at the windows prompt, I get 'Niña', but if my program does this: int main(){ std::string str("Niña"); std::cout << str << std::endl; return 0; } I get Ni±a
59
5025
by: Alan Silver | last post by:
Hello, This is NOT a troll, it's a genuine question. Please read right through to see why. I have been using Vusual Basic and Classic ASP for some years, and have now started looking at ASP.NET. At first glance, it looks excellent, albeit nothing that couldn't have been done to Classic ASP. I have been through a few tutorials and was impressed with how quickly you can get database info onto a page.
1
1716
by: Sean128 | last post by:
Hi, I hope someone can help me - this seems like it should be a really simple problem but I've been having trouble trying to solve it all week. I have hosted my website on a Linux server in 1 and 1 that I can not modefiy the Apache server. They told me I need to create the .htaccess file. The code that I put in my Biocon folder in my .htaccess file is: php_value include_path "/bioconstore/lib:/plate-latest"
1
2481
by: Sean128 | last post by:
Hi, I hope someone can help me - this seems like it should be a really simple problem but I've been having trouble trying to solve it all week. I have hosted my website on a Linux server in 1 and 1 and I can not modefiy the Apache server. They told me I need to create the .htaccess file. The code that I put in my .htaccess file is: php_value include_path "/bioconstore/lib:/plate-latest"
6
2275
by: fido19 | last post by:
Once upon a time, there lived a chimpanzee called Luycha Bandor (aka Playboy Chimp). Luycha was unhappily married to Bunty Mona, a short but cute little lady chimp. Luycha was tall and handsome – he was feeling uncomfortable taking Bunty to public places along with him. People would stare at them all the while. At one point, Luycha could not stand it anymore and he decided to do some justice to his name. He started looking for a new hope in...
0
9617
marktang
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
10257
Oralloy
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
10037
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8931
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7456
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6710
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
1
4007
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3609
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2849
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.