Question: hello can anyone convert this java code to c++ code import java.io.BufferedReader; import java.util.HashMap; import java.util.Scanner; import java.io.File; import java.io.IOException; public class Index { public
hello can anyone convert this java code to c++ code
import java.io.BufferedReader; import java.util.HashMap; import java.util.Scanner; import java.io.File; import java.io.IOException;
public class Index { public static HashMap
// Initialise a hashmap HashMap
// close the FIle iScanner.close(); aScanner.close();
// return map return map; } catch (IOException e) { // unable to open file System.err.println("Unable to open file: " + e); // retuen an empty hashmap return new HashMap
// main method public static void main(String[] args) { // create the HashMap HashMap
System.out.println("Enter index: "); String index = scn.next();
// check if index exists if (indexMap.containsKey(index)) { // print System.out.println(index + " refers to " + indexMap.get(index)); } else { // not found System.out.println(index + " not found");
} // close scanner scn.close(); } }
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
