Sign In
Not register? Register Now!
You are here: HomeOther (Not Listed)Technology
Pages:
5 pages/≈2750 words
Sources:
No Sources
Level:
Other
Subject:
Technology
Type:
Other (Not Listed)
Language:
English (U.S.)
Document:
MS Word
Date:
Total cost:
$ 39.95
Topic:

Programming: Finding Errors in Codes (Other (Not Listed) Sample)

Instructions:

Q1. The following code causes some compilation errors. Find them and correct them.
Answers
#include
class A {
public:
A() {
std::cout << "constructing object of class A" << std::endl;
}
~A() {
std::cout << "destroying object of class A" << std::endl;
}
void setDatum(int i) {
theDatum = i;
}
int getDatum(void) {
return theDatum;
}
private:
int theDatum;
};
int main(int argc, char** argv) {
A a;
a.setDatum(5);
std::cout << a.getDatum() << std::endl;
return 0;
}
What is the corrected program output when executed with ./debug2 ?
Q2 .Write a program that prints its own (executable) file size in bytes and in number of printable characters (a character char c is printable if (isalnum(c) > 0 || ispunct(c) > 0 || isspace(c) > 0)).
Q3. Write a program that prints the name of the image files referenced in the the web page http://www.enseignement.polytechnique.fr/index.html. Image files are referenced in HTML both by the attribute HREF of the tag A (e.g. ) and by the attribute SRC of the tag IMG (e.g. ). The output should be as follows.
images/entete1.gif
images/remise.gif
images/amphi.gif
/icones/home.gif

source..
Content:


Programming
Subjective
SUBMITTED TO:
topwriters
SUBMITTED BY:
Q1. The following code causes some compilation errors. Find them and correct them.
Answers
#include
class A {
public:
A() {
std::cout << "constructing object of class A" << std::endl;
}
~A() {
std::cout << "destroying object of class A" << std::endl;
}
void setDatum(int i) {
theDatum = i;
}
int getDatum(void) {
return theDatum;
}
private:
int theDatum;
};
int main(int argc, char** argv) {
A a;
a.setDatum(5);
std::cout << a.getDatum() << std::endl;
return 0;
}
What is the corrected program output when executed with ./debug2 ?
Answer;
Output:

...
Get the Whole Paper!
Not exactly what you need?
Do you need a custom essay? Order right now:

Other Topics:

  • Writing Programming Codes and Code Compilation Errors
    Description: The following code causes some compilation errors. Find them and correct them. Answers #include class A { public: A() { std::cout << "constructing object of class A" << std::endl; } ~A() { std::cout << "destroying object of class A" << std::endl; } void setDatum(int i) { theDatum = i; } int getDatum(void) {...
    5 pages/≈1375 words| No Sources | Other | Technology | Other (Not Listed) |
  • Kohler Cimarron Toilet Reviews Research Assignment
    Description: Comfort Height; feature offers chair-height seating that makes sitting down and standing up easier for most adults....
    3 pages/≈825 words| 1 Source | Other | Technology | Other (Not Listed) |
  • Python Coding, Running Programming Assignment Paper
    Description: NAMES = ['Adam', 'Betty', 'Charlie', 'Debbie', 'Elaine', 'Frank' 'George','Harry', 'Igor', 'Jack', 'Kevin', 'Larry', 'Moe', 'Nancy', 'Ophelia', 'Phil', 'Quentin']...
    3 pages/≈825 words| No Sources | Other | Technology | Other (Not Listed) |
Need a Custom Essay Written?
First time 15% Discount!