int finalRadius = 0;
std::cout << "final radius : ";
std::cin >> finalRadius;
std::cout << std::endl;
for (int radius = initialRadius; radius <= finalRadius; radius += increment)
{
std::cout << "The volume of a sphere with a radius of " << radius << " is " << (4.0 / 3.0)*PI*pow(radius, 3) << std::endl;
}
return 0;
}
Assignment 1 Q1
// A1 Q1.cpp : Defines the entry point for the console application.
//
#include "stdafx.h"
#include <iostream>
int main()
{
int temperature = 0;
std::cout << "Enter a temperature : ";
std::cin >> temperature;
if (temperature <= -173)
{
std::cout << "Ethyl alcohol will freeze at that temperature" << std::endl;
}
if (temperature <= -38)
{
std::cout << "Mercury will freeze at that temperature" << std::endl;
}
if (temperature <= -362)
{
std::cout << "Oxygen will freeze at that temperature" << std::endl;
}
if (temperature <= 32)
{
std::cout << "Water will freeze at that temperature" << std::endl;
}
if (temperature >= 172)
{
std::cout << "Ethyl alcohol will boil at that temperature" << std::endl;
}
if (temperature >= 676)
{
std::cout << "Mercury will boil at that temperature" << std::endl;
}
if (temperature >= -306)
{
std::cout << "Oxygen will boil at that temperature" << std::endl;
}
if (temperature >= 212)
{
std::cout << "Water will boil at that temperature" << std::endl;
}
return 0;
}
Q2
// A1 Q2.cpp : Defines the entry point for the console application.
//
#include "stdafx.h"
#include <iostream>
int main()
{
int store1 = 0;
std::cout << "Enter store 1 sales : ";
std::cin >> store1;
int store2 = 0;
std::cout << "Enter store 2 sales : ";
std::cin >> store2;
int store3 = 0;
std::cout << "Enter store 3 sales : ";
std::cin >> store3;
int store4 = 0;
std::cout << "Enter store 4 sales : ";
std::cin >> store4;
int store5 = 0;
std::cout << "Enter store 5 sales : ";
std::cin >> store5;