1D Heat Equation Solver
1.0
Computational Methods Assignment 2025
Loading...
Searching...
No Matches
user_input.cpp
Go to the documentation of this file.
1
#include "
user_input.h
"
2
3
/**
4
* @brief Implementation for integer input.
5
*/
6
int
askForInteger
(
7
const
std::string& prompt,
8
const
std::function<
bool
(
int
)>& isValid,
9
const
std::string& errorMessage
10
) {
11
return
askForNumber<int>
(prompt, isValid, errorMessage);
12
}
13
14
/**
15
* @brief Implementation for floating-point input.
16
*/
17
double
askForDouble
(
18
const
std::string& prompt,
19
const
std::function<
bool
(
double
)>& isValid,
20
const
std::string& errorMessage
21
) {
22
return
askForNumber<double>
(prompt, isValid, errorMessage);
23
}
askForInteger
int askForInteger(const std::string &prompt, const std::function< bool(int)> &isValid, const std::string &errorMessage)
Implementation for integer input.
Definition
user_input.cpp:6
askForDouble
double askForDouble(const std::string &prompt, const std::function< bool(double)> &isValid, const std::string &errorMessage)
Implementation for floating-point input.
Definition
user_input.cpp:17
user_input.h
Utility functions for safe user input from the console.
askForNumber
T askForNumber(const std::string &prompt, const std::function< bool(T)> &isValid, const std::string &errorMessage)
Generic template for asking a numeric value from the user.
Definition
user_input.h:30
src
user_input.cpp
Generated by
1.15.0