199k views
11 votes
Wtite a command to convert the points variable to any numerical data type (integer or float)

User Selwyn
by
4.1k points

2 Answers

6 votes
String points = 200 for Java
User Jonauz
by
3.5k points
4 votes

I am not sure what programming language that you are programming for, but I will assume Python/Java/C++.

Python:

points = "200"

points_Integer = int(points)

Java:

String points = "200"

int points_Integer = Integer.parseInt(points)

C++:

string points = "200";

int points_integer;

points_integer = (int) points;

I hope that this helps!

User Arthur Noseda
by
3.5k points