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

User Selwyn
by
8.1k points

2 Answers

6 votes
String points = 200 for Java
User Jonauz
by
7.7k 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
7.7k points

Related questions

asked Feb 17, 2024 225k views
Paul Vernon asked Feb 17, 2024
by Paul Vernon
7.1k points
1 answer
4 votes
225k views
asked Sep 11, 2024 101k views
Mark Cranness asked Sep 11, 2024
by Mark Cranness
8.2k points
1 answer
2 votes
101k views