Programming Errors - Computers and Programming I - Home Work, Lecture notes of Computer Programming

Some concept of Computers and Programming I are Assign Value, Single-Subscripted Array, Class Members, Current Precision, Elementary School, Complete Program, Fibonacci Sequence, Programming Errors. Main points of this homework are: Programming Errors, Programming Errors, Correct, Function Definition, Maximum, Include, Void Printname, Ming Zhang, Void Printname

Typology: Lecture notes

2012/2013

Uploaded on 04/27/2013

kid
kid 🇮🇳

4.3

(18)

110 documents

1 / 2

Toggle sidebar

This page cannot be seen from the preview

Don't miss anything!

bg1
Read the following programs, find out the programming errors and correct
them.
Question 1
// 5 errors
#include <iostream>
int main
{
cout << “My first name is:Ming”
>> endl
cout << “My last name is: Zhang”
<< endl;
Question 2
// 5 errors
#include <iostream>
using std::cout
void main( )
{ float radius; height, volume;
radius ==10;
volume = 3.1416*radius*radius;
cout <<“The value of the circle area is” << volume << endl;
return(0) }
Question 3
// 5 errors
int main( )
pf2

Partial preview of the text

Download Programming Errors - Computers and Programming I - Home Work and more Lecture notes Computer Programming in PDF only on Docsity!

Read the following programs, find out the programming errors and correct them.

Question 1

// 5 errors #include

int main { cout << “My first name is:Ming”

endl cout << “My last name is: Zhang” << endl;

Question 2 // 5 errors

#include using std::cout void main( ) { float radius; height, volume; radius ==10; volume = 3.1416radiusradius; cout <<“The value of the circle area is” << volume << endl; return(0) }

Question 3 // 5 errors

int main( )

{int count = 0; cout <<“The initial value of count is”<<count<<endl; ++count; cout >>“count is now ”>> count >> endl; ++count, ++count; cout <<“count is now”<< count <<endl; return(0);}

Question 4

// 5 errors #inlude using std:cout; int main( ) { double a=5.3; b=4.0; product1; int product2; product1 = a * b; product2 = (int) (a*b) product1 = (int) a * b; cout << “product1=“ << product1 << endl; cout << “product2=“ << product2 << endl; return(0); }