EvilZone
Programming and Scripting => Projects and Discussion => : berserk 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 !
#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!
-
All answers the last 3 digits indicate how old you are, the first digit being the month, and the last 2 being your age.
-
I'm aware of that. What i don't know is how to get the computer to output that! that's my question
-
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