Question

1. Answer the following questions: a) 2 pts] Explain why it is important to indent code. What happens if code is not indented

in C++

0 0
Add a comment Improve this question Transcribed image text
Answer #1

a) With proper code indentation, it becomes

  • Easier to read the code
  • Easier to understand the code
  • Easier to modify the code
  • Easier to maintain the code

Without code indentation, readability takes a hit, and it becomes really difficult to enhance the code in future.

c) Without the const keyword, it is possible to modify the value of the the constant later on. Hence, without const keyword, the whole purpose of constant is lost.

d)

int main() {

char ch;

if (ch != ' ') {

cout << "ch is not a space!";

}

}

NOTE: As per HOMEWORKLIB POLICY I am allowed to answer specific number of questions (including sub-parts) on a single post. Kindly post the remaining questions separately and I will try to answer them. Sorry for the inconvenience caused.

Add a comment
Know the answer?
Add Answer to:
in C++ 1. Answer the following questions: a) 2 pts] Explain why it is important to...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • 1.Explain why computers have both main memory and secondary storage. 2.Explain the operations carried out by...

    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...

  • This is a Linux class I need with Writeup questions please. Lab Writeup Answer the following...

    This is a Linux class I need with Writeup questions please. Lab Writeup Answer the following questions in the comment box on Moodle: 1. What is the compiler option to enable level 2 optimization? 2. What is the compiler option to define a macro called CAPACITY with a value of 100? 3. Give the compiler line which will create an executable called 'lab1-18' from a source code file called 'lab1 18.cpp' using return-type warnings and pendantic- errors. 4. Look at...

  • A.2 5 pts - VWhat is a dangling/stale pointer? And please give code example [Yes ]No...

    A.2 5 pts - VWhat is a dangling/stale pointer? And please give code example [Yes ]No Does delete delete a pointer? Please explain why. Then please give instructions how to properly deallocate an object allocated on Free-Store. Please ample to demonstrate. use a code

  • Using PuTTY Linux Server Task Compiling:             1) Download the two files from blackboard, driver.cpp, and...

    Using PuTTY Linux Server Task Compiling:             1) Download the two files from blackboard, driver.cpp, and circle.h             2) Create a new directory to store the files in             3) Compile the code a) Run the command g++ driver.cpp -o executable_name, this will compile the code both for driver.cpp and the referenced file circle.h note: -o parameter specifies a new name for the executable, if you do not specify the “-o” parameter the default name of the executable is “a.out”...

  • explain in terms of c++ 1.     How to calculate the value of a short int and of...

    explain in terms of c++ 1.     How to calculate the value of a short int and of an int by looking at the values in hexadecimal.  Give an example for a short int and an int 2.     How the same bytes can represent such different values when read into the different data types 3.     Explain in your own words why the hexadecimal values for the chars, short ints and ints aren't in the same order

  • ELEC 1520 Homework - Integer Operations, Selection Statements Instructions Write C++ programs to solve the following...

    ELEC 1520 Homework - Integer Operations, Selection Statements Instructions Write C++ programs to solve the following two problems. Upload your source code files to Canvas. The file names must be of the form coins_your_name.cpp and bonus_your_name.cpp for problems 1 and 2, respectively. Substitute your first and last name for "your_name" in the file name. Problem Statements 1. Given a value V in cents, you need to make change using a minimum number of coins. Assume you have an infinite supply...

  • c++ please answer b to e P " b) (2 pts) When we insert an element,...

    c++ please answer b to e P " b) (2 pts) When we insert an element, 5, to the following max heap, what would be the resulting max heap? Give the detailed procedure. 20 c) (2 pts) Based on b), when we remove the root element in the max heap, what would be the resulting max heap? Give the detailed procedure. d) (7 pts) Describe how HeapSort works. Then use the example 20 10 5 15 35 30 25 to...

  • Give two examples of fiscal stimuli (4pts each=8 pts) and explain why/when a government would use...

    Give two examples of fiscal stimuli (4pts each=8 pts) and explain why/when a government would use these (4pts). Explain how corporate tax cuts could be an engine for economic growth (5 pts). According to the RWM article, explain 2 ways the GOP Tax plan could increase income inequality (4 pts each=8pts).[hints: using an example to explain the need for fiscal stimuli and what it is may be helpful in answering this question].

  • Eclipse Java Oxygen Question 11 pts A compile-time error occurs when Group of answer choices c....

    Eclipse Java Oxygen Question 11 pts A compile-time error occurs when Group of answer choices c. there’s a syntax error in a Java statement a. the Java compiler can’t be located b. bytecodes can’t be interpreted properly c. there’s a syntax error in a Java statement Flag this Question Question 21 pts An error that lets the application run but produces the wrong results is known as a Group of answer choices d. syntax error c. logic error a. runtime...

  • Please answer the following questions on your words: 1.Explain how improving quality can lead to reduce...

    Please answer the following questions on your words: 1.Explain how improving quality can lead to reduce cost? 2.How would you define high quality? 3.In supply chain, what is vertical integration? Give example of backward and forward integration? 4.What is JIT? 5.Does lean production work in service sector? Provide an example? 6.Which are lean techniques work in both manufacturing and service sectors?

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT