first commit
This commit is contained in:
parent
6a3935cac2
commit
4a29e375f5
3 changed files with 14 additions and 0 deletions
12
src/io.cpp
12
src/io.cpp
|
@ -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";
|
||||
}
|
1
src/io.h
1
src/io.h
|
@ -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();
|
|
@ -4,6 +4,7 @@
|
|||
|
||||
int main()
|
||||
{
|
||||
// string_demo();
|
||||
// add_two_numbers();
|
||||
// convert_char_to_ascii();
|
||||
print_type_size_bytes();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue