know the required data type. | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 2

know the required data type.

while coding when we get the constraints. then its important to choose the appropriate data type for the variable. for example. if 1<=var_num<=(10^28) 0<=var_test<=(10^5) so what will be the required data type for var_test and var_num? if we can design a program when we input the value. it will give the respective suitable data type.

28th Sep 2017, 1:15 PM
Sudipta Kumar Nath
Sudipta Kumar Nath - avatar
6 Answers
+ 4
thankx but produced infinite loop for my input
6th Oct 2017, 7:18 PM
Sudipta Kumar Nath
Sudipta Kumar Nath - avatar
+ 3
no. i just want a scripted program. for example if we enter a value, let that be in a string format. then the progam will analyze the value. and will tell the appropriate datatype of that value. the out put would look like int or long int or double or long long. according to the value. hope you got my question.
28th Sep 2017, 7:28 PM
Sudipta Kumar Nath
Sudipta Kumar Nath - avatar
+ 1
Thank you. I understand it now, would be fun to create it.
28th Sep 2017, 7:31 PM
sneeze
sneeze - avatar
+ 1
sorry for that. https://code.sololearn.com/cEAjFDu2mVnK This code does not need console.readline(). Because it loops through the array.
6th Oct 2017, 7:41 PM
sneeze
sneeze - avatar
0
I do not really understand your question ? Are you looking for an AI for types. Do you want a questionaire. Saying 1) is it a whole number. Or do you want a string analyser, that analyses string input and convert the string in an approperiate type.
28th Sep 2017, 7:22 PM
sneeze
sneeze - avatar
0
Have been busy working on it. https://code.sololearn.com/c1pRZVe01xq7 This is what it is right now. Funny to see that is recognizes string StringG = "1.23E+11"; as a float string StringA = "10^28"; string StringB = "10^5"; string StringH = "1.23 X 10^11"; So it does recognize "E" but not "^" Can you refrase these string so, it would be a acceptable string for parse methods I had in mind to implement 2 methods 1) with parse 2) by hand But when doing the implentation of the parse method, it came in to my mind that there is no such thing a doing by hand in programming, So the second method is not implement edit : removed second method and user input request
6th Oct 2017, 7:42 PM
sneeze
sneeze - avatar