Welcome to Minetown!
To join our community, please login or register!
Internet Explorer
Internet Explorer is not supported. Please upgrade to a more modern browser.

[Enjin Archive] This weeks C++ homework!
Started by Unknown User

As I found out last week, Cryston and probably more of you guys are actually quite proficient with C++, Java, etc.

So if you guys want, you can help me out with my projects for my C++ class. Using Microsoft Visual Studio 2010 or 2008 I have to make these projects.

1. Write a program that asks for first name, last name, and birth year then prints thefull name and age based on the input. The program should look like the following when run:

What is your first name? John

What is your last name? Doe

What is your birth year? 1995

Hello John Doe you are either 15 or 16 years old.



2. Write a program that asks for 3 numbers between 1 and 6 digits in length. The program should print the three numbers so that they are aligned. The program should look like the following when run:

Enter three numbers, each between 1 and 6digits: 123 12 123456

123

12

123456



3. Write a program that divides two integers but outputs the result as a float or double. Use static_cast tomake sure the result is accurate. The program should look like the following when run:

Enter integer 1: 5

Enter integer 2: 4

5 divided by 4 is 1.25

This is only project 2 so this stuff is still reallly simple. If you wanna help just post <object class="emojione" data="https://resources.enjin.com/1489581540/themes/core/images/emojione/svg/1f642.svg?0" type="image/svg+xml" standby=":)">:)</object> thanks

Ah yes, I think the answer is D.

~SN
I refuse to do my homework.
the answer is ALT-F4
>.> I self-taught myself Python, don't know any C++. Been meaning to one of these days though
lol damn, wheres cryston!!!
#include <iostream>

int main()

{

string name1;

string name2;

int year;

cout<<"what is your first name?";

cin>>name1;

cout<<"\nwhat is your last name?";

cin>>name2;

cout<<"\nwhat is your birth year?";

cin>>year;

int age=2010-year;

cout<<"Hello"<<name1<<name2<< "you are either"<<age<<" or "<<(age+1)<<" years old."<<endl;
char firstname;

char lastname;

int yearborn;

cout<<"What is your first name?\n";

cin>>firstname;

cout<<"What is your last name?\n";

cin>>lastname;

cout<<"What year were you born?\n";

cin>>yearborn;

int currentage1 = 2011-yearborn;

int currentage2 = 2011 - yearborn-1;

cout<<"Hello "<< firstname <<" " << lastname << " you are either " << currentage2 << " or " << currentage1 << " years old.\n";

cin.get();

cin.get();
#include iostream

#include iomanip

using namespace std;

int main()

{

int i=0;

int num1=0;

int num2=0;

int num3=0;

cout<<"Enter three numbers, each between 1 and 6digits: "

cin>>num1

cin>>num2

cin>>num3

cout<<right<<"\n"<<num1<<"\n"<<num2<<"\n"<<num3
double num1;

double num2;cout<<"Enter integer 1:"

cin>>num1

cout<<"Enter integer 2:"

cin>>num2

cout<<num1<<" divided by "<<num2<<" is "<<(num1/num2)<<endl;