Ask Question
30 January, 20:15

Write code that uses the input string stream inss to read input data from string userinput, and updates variables usermonth, userdate, and useryear. sample output if userinput is "jan 12 1992":

+4
Answers (2)
  1. 30 January, 22:34
    0
    The solution code is written in C++

    string usermonth; int userdate, useryear; string userinput = "jan 12 1992"; istringstream inss; inss. str (userinput); inss>> usermonth>>userdate>>useryear; cout<
    Explanation:

    Firstly, declare three variables, usermonth, userdate and useryear (Line 1-2).

    Next declare another variable userinput to hold the input string (Line 4). Create an input string object, inss (Line 5) that can read the input string (Line 6). Once the input string is read into inss, we can use >> operator to update variable usermonth, userdate, and useryear (Line 8).

    We print the value of usermonth, userdate, and useryear at console terminal (Line 10) and we shall get:

    jan 12 1992
  2. 30 January, 23:11
    0
    It will be a java code.

    Explanation:

    import java. util. Scanner;

    public class StringInputStream {

    public static void main (String [] args) {

    Scanner inSS = null;

    String userInput = "Jan 12 1992";

    inSS = new Scanner (userInput); '

    String userMonth = "";

    int userDate = 0;

    int userYear = 0;

    / * Your solution goes here * /

    System. out. println ("Month: " + userMonth);

    System. out. println ("Date: " + userDate);

    System. out. println ("Year: " + userYear);

    return;

    }

    }
Know the Answer?
Not Sure About the Answer?
Find an answer to your question ✅ “Write code that uses the input string stream inss to read input data from string userinput, and updates variables usermonth, userdate, and ...” in 📘 Computers and Technology if you're in doubt about the correctness of the answers or there's no answer, then try to use the smart search and find answers to the similar questions.
Search for Other Answers