Author Topic: I need Help with my C++ homework  (Read 1103 times)

0 Members and 1 Guest are viewing this topic.

Offline berserk

  • NULL
  • Posts: 2
  • Cookies: 0
    • View Profile
I need Help with my C++ homework
« on: September 28, 2013, 03:39:33 am »
Good day I'm taking an intro to computer science class this semester and I'm having trouble figuring out this homework assignment. If anyone can help me that will be great! This is what i have so far when it comes to the code. I included the word doc of the assignment below. please help me and give me advice if possible! :D thank you !

Code: (c++) [Select]
#include <iostream>

using namespace std;

int main ()
{

int age; //to hold the users age
int DOB; // to hold the users date of birth;
int specialNumber, specialNumber1;

cout <<"Which month were you born in? For example enter 1 if you were born in Jan" << endl;

cin >> DOB;
cout << "Enter your age" << endl;
cin >> age;
specialNumber = (DOB * 2 +5) * 50 + (age) - 365;
specialNumber1 = specialNumber + 115;
cout << specialNumber << "the new number is " << specialNumber1;
cout << "Your Birthday is in "

return 0;
}

just an FYI we're not up to loops so if it's possible(which i believe it is) can someone help me solve it without using loops :D thank you!!!
I'm aware that the cout statements aren't with the professor is wanting but they're there just to test the input and to make sure everything is working out. My issue is that I'm not sure how i will get the computer to know that if the number that this adds up too, lets say for example the number adds up too "120" how will i be able to output "Your birthday is in the 1st month and you're 20 years old".

I hope I was able to articulate this well enough for you guys to understand. I hope you can help me!



 



 
« Last Edit: September 28, 2013, 08:38:10 am by Kulverstukas »

Offline hydroxypropylcellulose

  • /dev/null
  • *
  • Posts: 19
  • Cookies: -6
    • View Profile
Re: I need Help with my C++ homework
« Reply #1 on: September 28, 2013, 10:23:08 pm »
All answers the last 3 digits indicate how old you are, the first digit being the month, and the last 2 being your age.

Offline berserk

  • NULL
  • Posts: 2
  • Cookies: 0
    • View Profile
Re: I need Help with my C++ homework
« Reply #2 on: September 29, 2013, 02:25:14 am »
I'm aware of that. What i don't know is how to get the computer to output that! that's my question

Offline AlaskanIce

  • NULL
  • Posts: 1
  • Cookies: 0
    • View Profile
Re: I need Help with my C++ homework
« Reply #3 on: October 19, 2013, 07:26:51 am »
The Computer only adds what your friends last number he gives you and the 115.
Your friend takes his month of birth, you tell him to double it. Then take that doubled number and add 5. Then take that total number and times it by 50, while the next number will add his birth years - 365
This number you finish the 115
you assign it to a variable  then print that variable