Thursday, February 7, 2019

C++ Homeworks #1

Homework 1-1: Conditionals
  1. Take 2 numbers and print a multiplication table
  2. Convert Gallons to Liters
  3. Convert temperature from Fahrenheit to Celsius
  4. Convert number to names
  5. Create a help menu providing phone numbers for agents, institutions.
Homework 1-2: Lists, Loops, Files
  1. Write a program that will print A to F vertically on each new line.
  2. Create an array or list of numbers and calculate all.
  3. Make it interactive and take inputs from users until 'q' or 'Q' is presssed.
  4. Take inputs from file and print output to a file.
Homework 1-3: Numbers and Type Conversions
  1. Compute the circumference area of a circle given the radius.
  2. Take two numbers and calculate their GCD.
  3. Take two numbers and output the max / min / mean / sum of both.
  4. Convert Coins to currency amount
Homework 1-4: Fix it!
#include <stream>
int main
{
    cout << "If this text",
    cout >> " appears on your display, ";
    cout << " endl;"
    cout << 'you can pat yourself on '
    << " the back!" << endl.
    return 0;
)
Homework 1-5: Which of the followings are valid variable names in C++?
a
586_cpu
a_very_long_name123467890
b12
écu
goto
invalid
object-oriented
SetTextColor
top_of_window
true
US
us
US$
VOID
_var
$var 
Homework 1-6: Fix it!
int a(2.5); 
const long large;
int b = '?'; 
char c('\'');
char z(333); 
unsigned char ch = '\201';
int big = 50000; 
unsigned size(80000);
double he's(1.7E+5); 
float val = 54321.12345;
Homework 1-7: Use sizeof operator to show the number of bits occupied in memory by a variable
Write a c++ program that displays the memory space required by each data type.

No comments:

Post a Comment