0

How to assign a range for a variable in C++?

Question explains itself. Sprry I am new to C++. Please tell me how to assign a range for variables.

27th Jun 2018, 9:29 AM
R3zu4C
R3zu4C - avatar
4 Antworten
0
You can't assign a range to variable. You might be interested in arrays and iterators. Additonally, there is a Ranges TS that should soon be added to C++( within a few years)
27th Jun 2018, 11:16 AM
StefanGliga
StefanGliga - avatar
0
Every data type has it's own minimal range . int , long , short , double , float ,char etc . You cannot assign a range but you can set a range for an input
27th Jun 2018, 12:18 PM
Aveek Bhattacharyya
Aveek Bhattacharyya - avatar
0
Aveek Bhattacharyya , I meant: a variable int a which can hold a value from [1, 100] ?
27th Jun 2018, 12:54 PM
R3zu4C
R3zu4C - avatar
0
No you can't assign
27th Jun 2018, 12:54 PM
Aveek Bhattacharyya
Aveek Bhattacharyya - avatar