first commit

This commit is contained in:
ZennDev1337 2024-04-11 13:58:59 +02:00
parent 6a3935cac2
commit 4a29e375f5
3 changed files with 14 additions and 0 deletions

View file

@ -40,3 +40,15 @@ void print_type_size_bytes()
std::cout << std::setw(16) << "double:" << sizeof(double) << " bytes\n";
std::cout << std::setw(16) << "long double:" << sizeof(long double) << " bytes\n\n";
}
void string_demo()
{
using namespace std;
cout << "Enter your full name: ";
string name{};
getline(cin >> ws, name);
cout << "Enter your age: ";
int age{};
cin >> age;
int letters{static_cast<int>(name.length())};
cout << "Your age + length of name is: " << (letters + age) << "\n";
}

View file

@ -5,3 +5,4 @@ int read_number();
void write_answer(int x);
void convert_char_to_ascii();
void print_type_size_bytes();
void string_demo();

View file

@ -4,6 +4,7 @@
int main()
{
// string_demo();
// add_two_numbers();
// convert_char_to_ascii();
print_type_size_bytes();