Finish or complete the coding for me because syntax and code

Assignment Help C/C++ Programming
Reference no: EM13168511

 finish or complete the coding for me. because syntax  and codes, so the proram can execute correctly

// bases.cpp

 

#include <iostream>

 

using std::cout;

using std::cin;

using std::endl;

/* Include all necessary using statements from iostream */

 

#include <iomanip>

/* Include all necessary using statements from iomanip */

 

#include <cmath>

 

/* Write a user-defined manipulator width8 that sets

   the width to 8 */

 

/* Write a user-defined manipulator width12 that sets

   the width to 12 */

 

// function to convert a decimal number to a binary number

int convertBinary( int x )

{

   int power, result = 0;

 

   for ( power = 0; x >= pow( 2, power ); power++ ) ;

 

   for ( ; power >= 0; power-- ) {

      result *= 10;

 

      if ( x / pow( 2, power ) >= 1 ) {

         result++;

         x -= pow( 2, power );

      }

   }

 

   return result;

}

 

void printTable( int a[], const int size )

{

   cout << "\nTable with the numbers in various bases\n";

 

   /* Write a statement to left justify the following table */

   /* Write a statement to print the header, use the width8

      manipulator for spacing */

 

   for ( int i = 0; i < size; i++ )

      /* Write a statement to output the table of bases   */

      /* Octadecimal output should specify the base       */

      /* Hexadecimal output should include only uppercase */

 

   cout << "\nTable of formatted and unformatted "

        << "floating points\n";

 

   /* Write a statement to print header, use the width12

      manipulator for spacing */

 

   for ( int j = 0; j < size; j++ ) {

      double x = static_cast< double > ( a[ j ] );

      /* Write a statement to output the formatted vs.

         unformatted table */

      /* Formatted output should print in scientific notation,

         showing the decimal point and the sign, and

         have a precision of 2 */

      /* Undo formatting changes */

}

}

 

int main()

{

   int x[ 5 ] = { 0 };

 

   for ( int counter = 0; counter < 5; counter++ ) {

      cout << "enter number " << counter + 1 << ": ";

      cin >> x[ counter ];

 

      /* Write a statement to test if stream errors occurred */

      /* If there were stream errors, input another number   */

}

 

   printTable( x, 5 );

 

   return 0;

}

 

 

Reference no: EM13168511

Questions Cloud

The main function should prompt the user : The main function should prompt the user for the 2 numbers, call the function to display the correct label, then calculate and display the sum of the numbers. Call the function to display the correct label, then calculate and display the differenc..
What are bufferedinput/outputstreams : What are BufferedInput/OutputStreams and why are they used? Write some Java code to illustrate how to create a BufferedInputStream.
Prepare a pension worksheet for the pension plan : Prepare a pension worksheet for the pension plan in 2012 and prepare any journal entries related to the pension plan that would be needed at December 31, 2012.
All your code should be in the main method : Write a Java test program, all your code should be in the main method, that asks the user for two numbers representing an investment value and interest rate
Finish or complete the coding for me because syntax and code : finish or complete the coding for me. because syntax  and codes, so the proram can execute correctly
Result of increasingly sophisticated it : Discuss several career opportunities available to students who combine a study of accounting with course work in AISs, information systems, and/or computer science. Can you think of other jobs where these skill sets would be desirable?
Whenever a computer is idle : Whenever a computer is idle, we can either put it in stand by (where DRAM is still active) or we can let it hibernate. Assume that, to hibernate
Calculate the fraction of methyl isonitrile molecules : The activation energy for the isomerization of methyl isonitrile (see figure) is 160 kJ/mol. Calculate the fraction of methyl isonitrile molecules that has an energy of 160.0 kJ or greater at 493 K.
What speedup could be expected in the steady state : What speedup could be expected in the steady state by using a merging write buffer instead of a nonmerging buffer when zeroing memory by the execution of 64 bit stores if all other instructions could be issued in parallel with the stores and the b..

Reviews

Write a Review

C/C++ Programming Questions & Answers

  Write a matrix multiplication program

Write a C++, matrix multiplication program which you can instrument to monitor and measure execution time as a function of problem size. Make sure it works in Microsoft Visual Studio.

  Where s is any string

Write a function detab(s, stop), where s is any string, and stop is a positive integer called tabstop size. This function should return a string which is like s.

  Recursive function

What is the result of the following recursive function when called with mm(10)? Write out the execution trace of this call to mm(10).

  Complete the design and implementation

Complete the design and implementation of the class customerType defined in the Programming Example Video Store. b. Design and implement the class customerListType to create and maintain a list of customers for the video store.

  Program to declare array alpha of components of type int

Write C++ statements to do the following: Declare an array alpha of 15 components of the type int. Output the value of the tenth component of the array alpha.

  Up through 2 to the 10th power

program should compute and output all of the "powers of two" from 2 to the 0th power, up through 2 to the 10th power.

  You are the admissions office at abc medical university

You are the Admissions Office at ABC Medical University. You have a large number of applicants for a very few number of available openings at your school. As a result, you need to set some high admission standards. To be accepted, a student ..

  Which of the following are valid case statements in a switch

What will following segment of code output? int x = 5; if (x != 2)      System,out.println( "This is true!"); else      System.out.println( "This is false!");      System.out.println("This is all folks!");

  Design and write a c++11/fltk game program

The project is to design and write a C++11/FLTK game program with a graphical user interface. The game is based on "pancake sorting," which actually has some mathematical significance.

  Using virtual methods, organize the animals

Using virtual methods, organize the animals in a small zoo, having as guests lions, parrots, alligators, penguins, elephants, cobras, zebras, hawks, turkeys and rabbits.

  Creates a bus class

write a program that creates a bus class. create a constructor that initializes the number of passengers and number of seats. declare four objects. use the default copy constructor to initialize two of the objects.

  Program that read in from the key board a string

Write a complete C++ program that read in from the key board a string and convert all letters in the string to upper cases. You are not allowed to use toupper function.

Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd