java - How do i rename a integer to a string -
java - How do i rename a integer to a string -
how replace number user inputs selection actual corresponding string selection means in print line.
import java.util.scanner;   public class magicgame {   public static void main(string [] args)    {      string name;     int usercharacter;     int armorchoice;     int weaponchoice;       scanner input = new scanner(system.in);       system.out.println("please  come in name");     name = input.nextline();     {      system.out.println("please select character play:" + '\n' + "1 magic user" + '\n' + "2 fighter" + '\n' + "3 thief" + '\n' + "4 druid" );     usercharacter = input.nextint();      system.out.println("please select armor type:" + '\n' + "1 steel plate – armor class 10" + '\n' + "2 chain  mail service – armor class 5" + '\n' + "3 leather armor – armor class 3" + '\n' + "4 robe – armor class 1");     armorchoice = input.nextint();      system.out.println("please  take weapon:" + '\n' + "1 sword" + '\n' + "2 short sword" + '\n' + "3 scimitar" + '\n' + "4 dagger");     weaponchoice = input.nextint();       system.out.println("hello " + name + "! chose play " + usercharacter + "." + '\n' + "your armor is" + armorchoice + "." + '\n' + "you fighting " + weaponchoice + ".");   } }    it longer had trim down.
which programming language?
java:
string s = string.valueof(123); string s = 123 + "";    c++
int = 10; stringstream ss; ss << a; string str = ss.str();    c++0x
std::string s = std::to_string(42);    c#
string s = myint.tostring();        java 
 
  
Comments
Post a Comment