ravesli/lesson_60/main.cpp

32 lines
542 B
C++
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

/*
* main.cpp
*
* Created on: 11 сент. 2021 г.
* Author: alexander
*/
#include <iostream>
#include <string>
int main()
{
using std::string;
using std::cout;
using std::cin;
using std::endl;
using std::getline;
cout << "Enter your full name: ";
string name;
getline(cin, name);
cout << "Enter your age: ";
int age;
cin >> age;
cout << "You've lived " << static_cast<float>(age) / name.length()
<< " years for each letter in your name." << endl;
return 0;
}