Question

In: Computer Science

1a. char days[SIZE]; Create a C-String which uses days to store "Monday". 1b.To use things like...

1a. char days[SIZE]; Create a C-String which uses days to store "Monday".

1b.To use things like cout and cin you must use this line of code:

1c. Automatic conversion of an operand to another data type is known as:

1d. To use a string you must use this preprocessor directive:

1e. There are four types of data type modifiers for numerical data, provide one of them.

1f. char ch = 'A'; How would you type cast this to a double

1g. C++'s standard input stream is:

1h. auto number = 4; number = 14.4; cout << number; what is the output?

1l. To generate random numbers you must use this preprocessor directive:

1j. C++'s standard output stream is:

Solutions

Expert Solution

---------------------------------------------------

1a. char days[SIZE]; Create a C-String which uses days to store "Monday".
Answer: First of all question is not clear, if you meant use cstring prepossor directive method to copy
   "Monday" to days char array.
   -> Then answer is: strcpy(days,"Monday")
   if not please comment the question little more clearly. all the questions are clear except this one.
   thank you.


---------------------------------------------------

1b.To use things like cout and cin you must use this line of code:
Answer:
   if the question assumes that the header file iostream is alread imported.
       Statement: using namespace std;
       above Statement makes all the std properties global and can be accessed directly
       without std(std::cin or std::cout)
   else
       #include<iostream> is the line and you will have to use std::cin or std::cout for using cin and cout.

---------------------------------------------------

1c. Automatic conversion of an operand to another data type is known as:
Answer: implicit type conversion. compiler will convert the resultant data type to
   the largest operand data type.

---------------------------------------------------

1d. To use a string you must use this preprocessor directive:
Answer: #include<iostream>
   you should include iostream to use string type.

---------------------------------------------------

1e. There are four types of data type modifiers for numerical data, provide one of them.
Answer: signed , unsigned , long , short are the four types of modifiers.
   type modifiers allow us to modify the meaning of the base data type so it can match our requirement.
  

---------------------------------------------------

1f. char ch = 'A'; How would you type cast this to a double
Answer: double x = (double)ch;
   (double) infront of the char variable ch makes it to cast to double.

---------------------------------------------------

1g. C++'s standard input stream is:
Answer: cin is the c++ standard input stream.

---------------------------------------------------

1h. auto number = 4; number = 14.4; cout << number; what is the output?
Answer:
   Output would be 14.
   auto keyword assigns the data type for given variable at the time of it's initilization of a value.

---------------------------------------------------

1l. To generate random numbers you must use this preprocessor directive:
Answer: #include<cstdlib>
   cstdlib contains the rand() function that generates random number.

---------------------------------------------------

1j. C++'s standard output stream is:
Answer: cout
   cout is the standard output stream for c++;

---------------------------------------------------

ALL THE QUESTIONS ARE ANSWERED . PLEASE SPECIFY QUESTIONS MORE CLEARLY.
1A QUESTION IS QUITE NOT UNDERSTANDABLE, 1B IS LITTLE CONFUSING, IF YOU HAVE ANY DOUBTS
PLEASE COMMENT AND PLEASE LIKE THE ANSWER.


Related Solutions

-Write in C++ -Use Char library functions Write a function that accepts a string representing password...
-Write in C++ -Use Char library functions Write a function that accepts a string representing password and determines whether the string is a valid password. A valid password as the following properties: 1. At least 8 characters long 2. Has at least one upper case letter 3. Has at least one lower case letter 4. Has at least one digit 5. Has at least on special character
Create program which verifies if input string is a valid variable declaration or not. Use C...
Create program which verifies if input string is a valid variable declaration or not. Use C programming language. - This program can only use the following variable types: char, float, and int - Remove any newline \n from input string - The input prompt should say ">>> " - If input declaration is valid, it should print "Valid dec\n" - If input declaration is invalid, it should print "Invalid dec\n" - Make sure the identifier entered matches the rules of...
Please write code in c++. Use iostream (and any string library if you need it). Create...
Please write code in c++. Use iostream (and any string library if you need it). Create s structure plane : First line contains n(0 < n < 1001). Then n lines inputed in given format:   First - ID[int type]   Second - FromLocation[char*]   Third - ToLocation[char*]   Fourth - DepartureTime[char*] Output: Sorted list of planes should be in UPPER CASE. Example of input:(it's just one of an examples, you need to write code generally) 10 40 Shuch Satp 05:47 89 Kyzy Taldy  07:00...
C++ Only Create a function named PrintStudents, which takes a string input filename and an integer...
C++ Only Create a function named PrintStudents, which takes a string input filename and an integer minimum score value and a string output file name as a parameters. The function will read the student scores and names from the file and output the names of the students with scores greater than or equal to the value given. This function returns the integer number of entries read from the file. If the input file cannot be opened, return -1 and do...
C Programming language problem I need to write a program which uses several threads (like 8...
C Programming language problem I need to write a program which uses several threads (like 8 threads for example) to sum up a number. The following program is using 1 thread but I need several threads to compile it. There was a hint saying that using multiple separate for loop and combining them will make a multi-threaded program. #include <stdio.h> #include <stdlib.h> #include <pthread.h> int sum; // this data is shared by the threads void *runner(void *param); // threads call...
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT