c++
Please code a string object to be stored in 3 different memory and to hold "CSC340" as value. The please explain the main difference between the 3 methods.
Please help! Thank you!
We can create string object in 3 different memory and to hold "CSC340" as value.
i) string s1 {"CSC340"};
ii) string* s2 = new string {“CSC340”};
iii) static string s3 {“CSC340”};
When we create string object using the following statement
string s1 {"CSC340"};
then string object s1 created on the stack region from memory.
When we create string object using the following statement (using new operator)
string* s2 = new string {“CSC340”};
then string object s2 created on the heap region from memory.
And when we create string object using the following statement (using static keyword)
static string s3 {“CSC340”};
then static memory allocation take place
c++ Please code a string object to be stored in 3 different memory and to hold...
This is the question about object-oriend programming(java) please show the detail comment and prefect code of each class, Thank you! This question contain 7 parts(questions) Question 1 Create a class a class Cat with the following UML diagram: (the "-" means private , "+" means public) +-----------------------------------+ | Cat | +-----------------------------------+ | - name: String | | - weight: double | +-----------------------------------+ | + Cat(String name, double weight) | | + getName(): String | | + getWeight(): double | |...
Assume the cache can hold 64 kB. Data are transferred between main memory and the cache in blocks of 4 bytes each. This means that the cache is organized as 16K=2^14 lines of 4 bytes each. The main memory consists of 16 MB, with each byte directly addressable by a 24-bit address (2^24 =16M). Thus, for mapping purposes, we can consider main memory to consist of 4M blocks of 4 bytes each. Please show illustrations too for all work. Part...
1.Explain why computers have both main memory and secondary storage. 2.Explain the operations carried out by the preprocessor, compiler, and linker. 3.Explain what is stored in a source file, an object file, and an executable file. 4.What is an algorithm? 5.Describe difference between program line and a statement. 6.Is a syntax error found by the compiler or when the program is running? 7.What two units does the CPU consist of? 8.What happens to a variable’s current contents when a new...
Could anyone help?
Thank you.
B.6 - 10 pts string* callMe(string& s) { s = "Senorita"; return &s; int main() { string s = "Senor"; string* str = callme(s); cout << "Call me ""+ *str + "\""; return; What is the output or the error of this program? And please explain the data flow in detail (to memory level).
5.1 Automatic properties Choose One 4 points Given the following code where does the value assigned to the automatic property get stored? ?# 1 class Foo 2 3 string_name; 4 5 string Bar (get;set;) 7 8 10 static void Main() 12 13 object.Bar"Hello"; Foo object new Foo(); 14 0 In the-name field O in a hidden field created by the Property O The value is not stored O You have to create a field to hold the value
Please Help. C++. Need 3 attributes and 3 methods added to the code below. Need the prototype added to the .h file......and the implementation in the .cpp file....thanks! edited: I just need the above and then I was told to use the methods in the main program; for the vehicle. Any 3 attributes and any three methofds. source.cpp file // Header Comment #include #include #include #include "Automobile.h" using namespace std; struct Address{ string street; string city; string state; string zip;...
Please answer 2.6.1
2.6 The table below shows 32-bit values of an array stored in memory Address Data 24 38 2 4 32 36 40 2.6.1 [5] <COD §§22, 2.3-For the memory locations in the table above, write C code to sort the data from lowest to highest, placing the lowest value in the smallest memory location shown in the figure. Assume that the data shown represents the C variable called Array, which is an array of type int, and...
Program Description: A Java program is to be created to produce Morse code. The Morse code assigns a series of dots and dashes to each letter of the alphabet, each digit, and a few special characters (such as period, comma, colon, and semicolon). In sound-oriented systems, the dot represents a short sound and the dash represents a long sound. Separation between words is indicated by a space, or, quite simply, the absence of a dot or dash. In a sound-oriented...
code 3 different ways to insert a property-value pairing into a javascript object where the object name is Seneca, the property name is coursecode and the value is WEB322
java help plz.
6. Consider these questions about memory-answers are in HFJ Chapter 3 a. (5 pts) Assuming the same JVM, can the amount of memory taken up by an object reference differ for different kinds of objects (say String vs ArrayList<String>?) b. (5 pts) Assuming the same JVM, can the amount of memory taken up by the object itself differ for different kinds of objects .(5 pts) Can the amount of memory taking up for an object reference for...