Wednesday, June 27, 2018
Monday, June 11, 2018
Thursday, April 19, 2018
Monday, March 19, 2018
Thursday, March 15, 2018
Chapter 7 Homework Conditions and Test Results
Test 1
Enter a string: Larry Hobbs
Before removing vowels: Larry
After removing vowels: Lrry
Test 2
Enter a string: LarryHobbs
Before removing vowels: LarryHobbs
After removing vowels: LrryHbbs
Test 3
Enter a string: ThankGodItIsFriday
Before removing vowels: ThankGodItIsFriday
After removing vowels: ThnkGdtsFrdy
Test 4
Enter a string: ILoveC++
Before removing vowels: ILoveC++
After removing vowels: LvC++
Test 5
Enter a string: abcdefghijklmnopqrstuvwxyz
Before removing vowels: abcdefghijklmnopqrstuvwxyz
After removing vowels: bcdfghjklmnpqrstvwxyz
Test 6
Enter a string: ABCDEFGHIJKLMNOPQRSTUVWXYZ
Before removing vowels: ABCDEFGHIJKLMNOPQRSTUVWXYZ
After removing vowels: BCDFGHJKLMNPQRSTVWXYZ
Sample of multi-dimensional array done in class
#include "stdafx.h"
#include <iostream>
#include <string>
#include <iomanip>
using namespace std;
const int NO_ROOMS = 4;
const int NO_LEVELS = 3;
const int NO_ROWS = 9;
const int NO_SEATS = 15;
const string filler = " _____________________________________________________________";
enum room { ROOM1, ROOM2, ROOM3, ROOM4 };
enum level { FRONT, MIDDLE, UPPER };
enum rows { A, B, C, D, E, F, G, H, I, J };
int main()
{
char theater[NO_ROOMS][NO_LEVELS][NO_ROWS][NO_SEATS];
int i, j, k, l;
char seat;
for (i = 0; i < NO_ROOMS; i++)
for (j = 0; j < NO_LEVELS; j++)
for (k = 0; k < NO_ROWS; k++)
for (l = 0; l < NO_SEATS; l++)
theater[i][j][k][l] = ' ';
theater[2][2][5][8] = 'X';
theater[1][3][10][15] = 'X';
theater[2][1][9][2] = 'X';
for (i = 0; i < NO_ROOMS; i++)
{
cout << "Room " << i + 1 << endl;
for (j = 0; j < NO_LEVELS; j++)
{
cout << " Level " << j + 1 << endl;
cout << filler << endl;
for (k = 0; k < NO_ROWS; k++)
{
cout << "Row " << k + 1 << "|";
for (l = 0; l < NO_SEATS; l++)
{
if (theater[i][j][k][l] == 'X')
cout << " " << theater[i][j][k][l] << " |";
else
cout << " " << l << " |";
}
cout << endl << filler << endl;
}
cout << "\n\n";
}
}
}
#include <iostream>
#include <string>
#include <iomanip>
using namespace std;
const int NO_ROOMS = 4;
const int NO_LEVELS = 3;
const int NO_ROWS = 9;
const int NO_SEATS = 15;
const string filler = " _____________________________________________________________";
enum room { ROOM1, ROOM2, ROOM3, ROOM4 };
enum level { FRONT, MIDDLE, UPPER };
enum rows { A, B, C, D, E, F, G, H, I, J };
int main()
{
char theater[NO_ROOMS][NO_LEVELS][NO_ROWS][NO_SEATS];
int i, j, k, l;
char seat;
for (i = 0; i < NO_ROOMS; i++)
for (j = 0; j < NO_LEVELS; j++)
for (k = 0; k < NO_ROWS; k++)
for (l = 0; l < NO_SEATS; l++)
theater[i][j][k][l] = ' ';
theater[2][2][5][8] = 'X';
theater[1][3][10][15] = 'X';
theater[2][1][9][2] = 'X';
for (i = 0; i < NO_ROOMS; i++)
{
cout << "Room " << i + 1 << endl;
for (j = 0; j < NO_LEVELS; j++)
{
cout << " Level " << j + 1 << endl;
cout << filler << endl;
for (k = 0; k < NO_ROWS; k++)
{
cout << "Row " << k + 1 << "|";
for (l = 0; l < NO_SEATS; l++)
{
if (theater[i][j][k][l] == 'X')
cout << " " << theater[i][j][k][l] << " |";
else
cout << " " << l << " |";
}
cout << endl << filler << endl;
}
cout << "\n\n";
}
}
}
Thursday, March 08, 2018
Chapter 6 Homework Conditions and Test Results
Test 1 Enter yearly income: 15000 Enter the hourly rate: 70 Enter consulting time in minutes: 75 The billing amount is: 21.00 Test 2 Enter yearly income: 50000 Enter the hourly rate: 70 Enter consulting time in minutes: 20 The billing amount is: 0.00 Test 3 Enter yearly income: 50000 Enter the hourly rate: 70 Enter consulting time in minutes: 21 The billing amount is: 0.82 Test 4 Enter yearly income: 150000 Enter the hourly rate: 50 Enter consulting time in minutes: 180 The billing amount is: 93.33 Test 5 Enter yearly income: 35000 Enter the hourly rate: 25 Enter consulting time in minutes: 90 The billing amount is: 20.42
Wednesday, February 28, 2018
Chapter 5 Homework Conditions and Test Results
1. Ask for 2 numbers
2. Calculate how many multiples there are between the 2 numbers entered
A. How many multiples of 3 are there
B. How many multiples of 5 are there
3. Output the results
==========================================
Solution
Test 1
Enter two integers: 1 3
Multiples of 3 between 1 and 3: 1
Multiples of 5 between 1 and 3: 0
Test 2
Enter two integers: 100 5000
Multiples of 3 between 100 and 5000: 1633
Multiples of 5 between 100 and 5000: 981
Test 3
Enter two integers: 50 2
Multiples of 3 between 2 and 50: 16
Multiples of 5 between 2 and 50: 10
Test 4
Enter two integers: 451 21345
Multiples of 3 between 451 and 21345: 6965
Multiples of 5 between 451 and 21345: 4179
Test 5
Enter two integers: 3 3
Multiples of 3 between 3 and 3: 1
Multiples of 5 between 3 and 3: 0
Test 6
Enter two integers: 5 5
Multiples of 3 between 5 and 5: 0
Multiples of 5 between 5 and 5: 1
2. Calculate how many multiples there are between the 2 numbers entered
A. How many multiples of 3 are there
B. How many multiples of 5 are there
3. Output the results
==========================================
Solution
Test 1
Enter two integers: 1 3
Multiples of 3 between 1 and 3: 1
Multiples of 5 between 1 and 3: 0
Test 2
Enter two integers: 100 5000
Multiples of 3 between 100 and 5000: 1633
Multiples of 5 between 100 and 5000: 981
Test 3
Enter two integers: 50 2
Multiples of 3 between 2 and 50: 16
Multiples of 5 between 2 and 50: 10
Test 4
Enter two integers: 451 21345
Multiples of 3 between 451 and 21345: 6965
Multiples of 5 between 451 and 21345: 4179
Test 5
Enter two integers: 3 3
Multiples of 3 between 3 and 3: 1
Multiples of 5 between 3 and 3: 0
Test 6
Enter two integers: 5 5
Multiples of 3 between 5 and 5: 0
Multiples of 5 between 5 and 5: 1
Chapter 4 Homework Conditions and Test Results
1. Ask for the Bill Amount
2. Ask for the Amount being paid
3. Calculate what the amount being paid compares to the balance for credits and penalties
A. If you pay in full, you get either $10 or 1% credit(whichever is smaller)
B. If you pay at least 50% of the Bill, a 5% penalty is applied to the remaining balance.
C. If you pay at least 20% and less than 50% of the Bill, a 10% penalty is applied to the remaining balance.
D. If you pay any other balance amount of the Bill, a 20% penalty is applied to the remaining balance.
4. Calculate the output results and present to the user
A. Penalties or Credit if applicable
B. Remaining Balance
===============================================
Solution
Test 1
Enter the billing amount: 500
Enter the payment amount: 500
Thank you for paying the full amount.
You will receive $5.00 credit on your next bill.
Test 2
Enter the billing amount: 500
Enter the payment amount: 600
The penalty added to the next bill is: $-5.00
The unpaid balance including the penalty is: $-105.00
Test 3
Enter the billing amount: 50
Enter the payment amount: 10
The penalty added to the next bill is: $4.00
The unpaid balance including the penalty is: $44.00
Test 4
Enter the billing amount: 5000
Enter the payment amount: 25
The penalty added to the next bill is: $995.00
The unpaid balance including the penalty is: $5970.00
Test 5
Enter the billing amount: 500
Enter the payment amount: 251
The penalty added to the next bill is: $12.45
The unpaid balance including the penalty is: $261.45
2. Ask for the Amount being paid
3. Calculate what the amount being paid compares to the balance for credits and penalties
A. If you pay in full, you get either $10 or 1% credit(whichever is smaller)
B. If you pay at least 50% of the Bill, a 5% penalty is applied to the remaining balance.
C. If you pay at least 20% and less than 50% of the Bill, a 10% penalty is applied to the remaining balance.
D. If you pay any other balance amount of the Bill, a 20% penalty is applied to the remaining balance.
4. Calculate the output results and present to the user
A. Penalties or Credit if applicable
B. Remaining Balance
===============================================
Solution
Test 1
Enter the billing amount: 500
Enter the payment amount: 500
Thank you for paying the full amount.
You will receive $5.00 credit on your next bill.
Test 2
Enter the billing amount: 500
Enter the payment amount: 600
The penalty added to the next bill is: $-5.00
The unpaid balance including the penalty is: $-105.00
Test 3
Enter the billing amount: 50
Enter the payment amount: 10
The penalty added to the next bill is: $4.00
The unpaid balance including the penalty is: $44.00
Test 4
Enter the billing amount: 5000
Enter the payment amount: 25
The penalty added to the next bill is: $995.00
The unpaid balance including the penalty is: $5970.00
Test 5
Enter the billing amount: 500
Enter the payment amount: 251
The penalty added to the next bill is: $12.45
The unpaid balance including the penalty is: $261.45
Tuesday, February 27, 2018
Tuesday, December 05, 2017
Tuesday, October 24, 2017
ch8 ex 13 data file
Johnson 85 83 77 91 76
Aniston 80 90 95 93 48
Cooper 78 81 11 90 73
Gupta 92 83 30 69 87
Blair 23 45 96 38 59
Clark 60 85 45 39 67
Kennedy 77 31 52 74 83
Bronson 93 94 89 77 97
Sunny 79 85 28 93 82
Smith 85 72 49 75 63
Output file:
Aniston 80 90 95 93 48
Cooper 78 81 11 90 73
Gupta 92 83 30 69 87
Blair 23 45 96 38 59
Clark 60 85 45 39 67
Kennedy 77 31 52 74 83
Bronson 93 94 89 77 97
Sunny 79 85 28 93 82
Smith 85 72 49 75 63
Output file:
Name Test 1 Test 2 Test 3 Test 4 Test 5 Average Grade Johnson 85.00 83.00 77.00 91.00 76.00 82.40 B Aniston 80.00 90.00 95.00 93.00 48.00 81.20 B Cooper 78.00 81.00 11.00 90.00 73.00 66.60 D Gupta 92.00 83.00 30.00 69.00 87.00 72.20 C Blair 23.00 45.00 96.00 38.00 59.00 52.20 F Clark 60.00 85.00 45.00 39.00 67.00 59.20 F Kennedy 77.00 31.00 52.00 74.00 83.00 63.40 D Bronson 93.00 94.00 89.00 77.00 97.00 90.00 A Sunny 79.00 85.00 28.00 93.00 82.00 73.40 C Smith 85.00 72.00 49.00 75.00 63.00 68.80 D
Tuesday, October 10, 2017
Tuesday, September 05, 2017
Thursday, July 20, 2017
Unknown Error
If you get the Unknown Error with MS Visual Studio 2017 do thi:
I have a same problem after update VS 2017 Enterprise to the build 26228.9.
Repair installation doesn't fix anything. Still I got "Unknown error" message immediately after start VS2017.
Fixing is possible by removing this folder:
"C:\Users\USER_NAME\AppData\Local\Microsoft\VisualStudio\15.0_xxxxxxx"
Tuesday, July 18, 2017
Monday, July 17, 2017
Thursday, June 01, 2017
Wednesday, May 31, 2017
Thursday, April 27, 2017
In c++ the dot is an operator, what does it do
when you pass the if or of stream to a variable as a function how do you pass it
what do you put in front of a logical expression to reverse its value
4 choices: only one of them is a reserve word
++ operator : preincrement and postincrement:
Int a = 0
Int b = 0
B = ++A; means 1 is added to A then B becomes A: Preoperator
B = A++; means B becomes A then 1 is added to A: Postoperator
what is a valid char?
7 fill in the blanks, rest are multiple choice, total of 32 questions.
question 13 may want to use the compiler
For loop printing out the values of an array
DO you know the length of a string from looking at it?
calling conventions: two perspectives of a function: formal or actual: perspective
of the caller or the perspective of the called
static_cast{int}
two dimensional array
index operators
Member access specifier for a class
Inheritance: Base class and derived class?
which of the following class definitions makes the public members of the class A
class become the public members of the class B class
Question 26: Series of expressions: which one will evaluate to true? pick the one
that is ALWAYS true
Test does end with true or false questions actually
enum: understand the syntax
what is Macgyver's first name?
TO develop a program to solve a problem, you start by analyzing the problem.
when you pass the if or of stream to a variable as a function how do you pass it
what do you put in front of a logical expression to reverse its value
4 choices: only one of them is a reserve word
++ operator : preincrement and postincrement:
Int a = 0
Int b = 0
B = ++A; means 1 is added to A then B becomes A: Preoperator
B = A++; means B becomes A then 1 is added to A: Postoperator
what is a valid char?
7 fill in the blanks, rest are multiple choice, total of 32 questions.
question 13 may want to use the compiler
For loop printing out the values of an array
DO you know the length of a string from looking at it?
calling conventions: two perspectives of a function: formal or actual: perspective
of the caller or the perspective of the called
static_cast{int}
two dimensional array
index operators
Member access specifier for a class
Inheritance: Base class and derived class?
which of the following class definitions makes the public members of the class A
class become the public members of the class B class
Question 26: Series of expressions: which one will evaluate to true? pick the one
that is ALWAYS true
Test does end with true or false questions actually
enum: understand the syntax
what is Macgyver's first name?
TO develop a program to solve a problem, you start by analyzing the problem.
Subscribe to:
Posts (Atom)