Coder Social home page Coder Social logo

summativecode's Introduction

Summativecode

#include #include using namespace std;

int main() { string name; string lname; int age; char question;

cout << "Type your full name! " << endl;
cin >> name;
getline (cin, name);
if (name.size() <= 6) {
	cout << "Error!" << endl;
}
else if (name.size() >= 7) {
	cout << "Hello " << name << ", Type your age! (16-30)" << endl;
	cin >> age;

	//age 16-18
	if (age >= 16 && age <= 18) {
		cout << name << " Your age is " << age << ". Wanna go to the mall?" << endl;
		cout << "(y/n)" << endl;
		cin >> question;
		switch (question) {
			{
		case 'y':
		case 'Y':
			cout << "Enjoy!" << endl;
			break;
			}
			{
		case 'N':
		case 'n':
			cout << "Cancelled!" << endl;
			break;
			}
		default:
			(cin.fail());
			cin.ignore();
			cout << "Error!" << endl;
		}
	}
	//age 19-20
	else if (age >= 19 && age <= 20) {
		cout << name << " Your age is " << age << ". Wanna go to the theme park?" << endl;
		cout << "(y/n)" << endl;
		cin >> question;
		switch (question) {
			{
		case 'y':
		case 'Y':
			cout << "Enjoy!" << endl;
			break;
			}
			{
		case 'N':
		case 'n':
			cout << "Cancelled!" << endl;
			break;
			}
		default:
			(cin.fail());
			cin.ignore();
			cout << "Error!" << endl;
		}
	}
	//age 21-25
	else if (age >= 21 && age <= 25) {
		cout << name << " Your age is " << age << ". Wanna go to a trip to Istanbul?" << endl;
		cout << "(y/n)" << endl;
		cin >> question;
		switch (question) {
			{
		case 'y':
		case 'Y':
			cout << "Enjoy!" << endl;
			break;
			}
			{
		case 'N':
		case 'n':
			cout << "Cancelled!" << endl;
			break;
			}
		default:
			(cin.fail());
			cin.ignore();
			cout << "Error!" << endl;
		}
	}
	//age 26-30
	else if (age >= 26 && age <= 30) {
		cout << name << " Your age is " << age << ". Wanna go to trip to Hawaii?" << endl;
		cout << "(y/n)" << endl;
		cin >> question;
		switch (question) {
			{
		case 'y':
		case 'Y':
			cout << "Enjoy!" << endl;
			break;
			}
			{
		case 'N':
		case 'n':
			cout << "Cancelled!" << endl;
			break;
			}
		default:
			(cin.fail());
			cin.ignore();
			cout << "Error!" << endl;
		}
	}
	else {
		(cin.fail());
		cin.ignore();
		cout << "Error!" << endl;
	}
}

return 0;

}

summativecode's People

Contributors

makus014 avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.