-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathProgram1_4.cpp
More file actions
33 lines (26 loc) · 766 Bytes
/
Copy pathProgram1_4.cpp
File metadata and controls
33 lines (26 loc) · 766 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
#include <iostream>
#include "Program1_4.h"
namespace programs
{
void runProgram1_4()
{
float realValue{};
float* realValuePointer = &realValue;
int integerValue{};
int* integerValuePointer = &integerValue;
std::cout << "Enter a decimal value: " << std::flush;
if (!(std::cin >> *realValuePointer))
{
return;
}
std::cout << "The value entered directly is " << realValue << '\n';
std::cout << "The value entered through the pointer is " << *realValuePointer << '\n';
std::cout << "Enter an integer value: " << std::flush;
if (!(std::cin >> *integerValuePointer))
{
return;
}
std::cout << "The value entered directly is " << integerValue << '\n';
std::cout << "The value entered through the pointer is " << *integerValuePointer << '\n';
}
}