[try Beta version]
Not logged in

 
Please Help Me with This Program. It is Urgent

Mar 7, 2013 at 11:34am
Hello good people. Please help me with this C++ program. It is an assignment and I need to submit it as soon as possible.


1. A university has 200 student for a start, the student increase at a ratio of 20% yearly. How long will it take the university to have a population of 10,000? Write a C++ program to solve the problem.


2. Write a C++ program to calculate the value of y.

Y = 1/3 + 2/5 + 3/7 + ...........+ 1000/2001


Please help me out on this two program. Thanks.
Mar 7, 2013 at 11:35am
You need to have a go first. Show the particular piece of code that you're stuck on. Nobody is going to do your homework for you.
Mar 7, 2013 at 11:43am
if you can figure out how to do the maths then writing the programs shouldn't be a problem. try figure it out on paper first then focus on the programming
Mar 7, 2013 at 3:45pm
Am thinking of using a for loop for the first question and using using an increment operator for the counting. Pls help me out. I will be writing this exam in three days time.
Mar 7, 2013 at 4:25pm
You probably know your maths.
A for loop is a pretty good idea :)
Please show us some of your source code so that we can
help you with this!
Mar 7, 2013 at 5:16pm
easy but if i write code here it will not good for you. please work hard. this forum is to help you by sharing ideas. no one here to do homework
Mar 8, 2013 at 3:39am
Thanks. This was what I came up with. But its giving me a blank output. No result


#include <iostream>
using namespace std;
int main ()
{
int count, p;
for(int p=200; p<=10000; p++) //where p is the population
p = 200 + ((200/100) * 20);
count += p;
cin >> count;
return 0;
}

Mar 8, 2013 at 3:58am
cin >> count; is having the user input the value for count

I think you meant

cout << count;

Also you need to initialize variable count an initial value. 0 will work.
Topic archived. No new replies allowed.