menu
bartleby
search
close search
Hit Return to see all results

Is there anything wrong with my code? If so, explain and provide a remedy.    int SIZE = 25;    double values[SIZE];    for (int i = 1; i < SIZE; i++)    {         values[i] = 0.0;    }

Question

Is there anything wrong with my code? If so, explain and provide a remedy.

    int SIZE = 25;

    double values[SIZE];

    for (int i = 1; i < SIZE; i++)

    {

         values[i] = 0.0;

    }

check_circleAnswer
Step 1

Note:The given code is executed in C++. If you wants this program code to be executed and cleared with some other programming language, kindly mention the specific language.

Step 2

NO”, there is nothing wrong with the given program code.

A complete program should contain necessary header files and proper start and end tag. Other than this, there is nothing wrong.

The given code is little modified with starting and ending tag as follows,

//Declare header file

#include <iostream>

//Decclare namespace

using namespace std;

//Deffine main() function

int main()

{

    //Initialize the "SIZE" variable as "25"

    int SIZE = 25;

    //Declare the array "values" with size 25

    double values[SIZE];

    //Create "for" loop to iterate over array elements

    for (int i = 1; i < SIZE; i++)

 &n...

Want to see the full answer?

See Solution

Check out a sample Q&A here.

Want to see this answer and more?

Our solutions are written by experts, many with advanced degrees, and available 24/7

See Solution
Tagged in

Engineering

Computer Science

Programing Language

Related Computer Science Q&A

Find answers to questions asked by student like you

Show more Q&A add
question_answer

Q: Draw the truth tables for the following Boolean expressions. xy+yz+xz x¯y+yz¯+x¯z (x⊕y)+(y⊕z)+(x...

A: Hello. Since you have posted multiple questions and not specified which question needs to be solved,...

question_answer

Q: Write down a Unix command that will add the contents of a file named file1.txt and a file named file...

A: To add the content from one file to another file we use “cat” command in Unix.

question_answer

Q: In a server, the processor accounts for 50% of total server power, the memory system accounts for 30...

A: For a server,Power consumption of processor = 50 % of total powerPower consumption of memory system ...

question_answer

Q: This is for pygame Text Class The Text class inherits from Drawable and it will be used to display t...

A: Instructions for the Text class:Import the Drawable class and pygame module.Create a class Text and ...

question_answer

Q: Use the class, WhatPrints, to view what prints for each of the method calls below:doSomething(5);doS...

A: Explanation:In the given program, there are four methods which has the same method name with differe...

question_answer

Q: write a program in c++. You work for a box company, and have been asked to write a program to compar...

A: Solution:The C++ program has the following algorithm:Declare and initialize the required variables.D...

question_answer

Q: I am getting stuck on the code to see if its a factor or not. Im not sure where I went wrong.

A: The following is the source code which prints whether a number is a factor of generated random numbe...

question_answer

Q: Use K-Maps to simplify each of the following: ~x~y~z + ~xyz + ~xy~z ~x~y~z + ~xy~z + x~y~z + xy~z ~...

A: Since there are 3 variables we construct the K-Map as follows and find the minimal cover of the map ...

question_answer

Q: create a file in c++. In this lab, you will replace the existing functions with more flexible ones, ...

A: Program Instructions:Define the necessary constants and header files.Use displayMessage() function t...

Sorry about that. What wasn’t helpful?