Thinking in C++ Solutions

Please use the following link in order to receive every week at least one solution from the Thinking in C++ Solutions book:

http://mailing.waszczyk.com/?p=subscribe

//: S02:Area.cpp
//{-T} @echo run Area by hand!
#include <iostream>
using namespace std;
 
int main() {
  const float pi = 3.141592654;
  cout << "Enter the radius: ";
 
  float radius;
  cin >> radius;
  cout << "The area is " << pi * radius * radius << endl;
}
 
/* Sample Execution:
c:>area
Enter the radius: 12
The area is 452.389
// Saying Hello with C++
#include <iostream> // Stream declarations
using namespace std;
 
int main() {
  cout << "Hello, World! I am " 
    << 8 << " Today!" << endl;
}
//: S02:Hello2.cpp
#include <iostream>
using namespace std;
 
int main() {
  cout << "Hello, World! I am Chuck Allison." << endl;
  cout << "I have two dogs:" << endl;
  cout << "Sheba, who is " << 5 << ", and" << endl;
  cout << "Muffy, who is 8." << endl;
  cout << "(I feel much better!)" << endl;
}

Dodaj komentarz

Twój adres email nie zostanie opublikowany. Pola, których wypełnienie jest wymagane, są oznaczone symbolem *