aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMusa Ahmed <[email protected]>2022-10-26 17:25:52 -0700
committerMusa Ahmed <[email protected]>2022-10-26 17:25:52 -0700
commit531573350bbc73456f9469ea38db4f727f7f444c (patch)
treefb249d4c4e636f20b63464f0fb4d1f63a2603d45
parentdecimal places (diff)
downloadcst116-proj1-main.tar.xz
cst116-proj1-main.zip
Finished part 2HEADmain
-rw-r--r--CST116-Ch5-Debugging/CST116 - Project 1.sln10
-rw-r--r--CST116-Ch5-Debugging/CST116-Ch5-Debugging.vcxproj2
-rw-r--r--CST116-Ch5-Debugging/CST116-Ch5-Debugging.vcxproj.filters2
-rw-r--r--CST116-Ch5-Debugging/Part2.cpp134
-rw-r--r--CST116-Ch5-Debugging/Project1.cpp112
5 files changed, 146 insertions, 114 deletions
diff --git a/CST116-Ch5-Debugging/CST116 - Project 1.sln b/CST116-Ch5-Debugging/CST116 - Project 1.sln
index 0e0f5ba..9689d34 100644
--- a/CST116-Ch5-Debugging/CST116 - Project 1.sln
+++ b/CST116-Ch5-Debugging/CST116 - Project 1.sln
@@ -5,6 +5,16 @@ VisualStudioVersion = 17.3.32804.467
MinimumVisualStudioVersion = 10.0.40219.1
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "CST116-Ch5-Debugging", "CST116-Ch5-Debugging.vcxproj", "{656289CE-6A7B-4681-B61A-B8BD2CF9E712}"
EndProject
+Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "PROJECT 1", "PROJECT 1", "{75BE3CA3-ED6B-4ABD-8D38-433BC3776801}"
+ ProjectSection(SolutionItems) = preProject
+ ..\..\..\..\OneDrive\Desktop\Project1\Part-Partner-Errors.txt = ..\..\..\..\OneDrive\Desktop\Project1\Part-Partner-Errors.txt
+ ..\..\..\..\OneDrive\Desktop\Project1\Part1-Completed.txt = ..\..\..\..\OneDrive\Desktop\Project1\Part1-Completed.txt
+ ..\..\..\..\OneDrive\Desktop\Project1\Part1-My-Errors.txt = ..\..\..\..\OneDrive\Desktop\Project1\Part1-My-Errors.txt
+ ..\..\..\..\OneDrive\Desktop\Project1\Part1-Partner-Errors.txt = ..\..\..\..\OneDrive\Desktop\Project1\Part1-Partner-Errors.txt
+ ..\..\..\..\OneDrive\Desktop\Project1\Part2-Completed.txt = ..\..\..\..\OneDrive\Desktop\Project1\Part2-Completed.txt
+ ..\..\..\..\OneDrive\Desktop\Project1\Pseuodocode.txt = ..\..\..\..\OneDrive\Desktop\Project1\Pseuodocode.txt
+ EndProjectSection
+EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|x64 = Debug|x64
diff --git a/CST116-Ch5-Debugging/CST116-Ch5-Debugging.vcxproj b/CST116-Ch5-Debugging/CST116-Ch5-Debugging.vcxproj
index 4d8debf..a0a5c08 100644
--- a/CST116-Ch5-Debugging/CST116-Ch5-Debugging.vcxproj
+++ b/CST116-Ch5-Debugging/CST116-Ch5-Debugging.vcxproj
@@ -127,7 +127,7 @@
</Link>
</ItemDefinitionGroup>
<ItemGroup>
- <ClCompile Include="Project1.cpp" />
+ <ClCompile Include="Part2.cpp" />
</ItemGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Label="ExtensionTargets">
diff --git a/CST116-Ch5-Debugging/CST116-Ch5-Debugging.vcxproj.filters b/CST116-Ch5-Debugging/CST116-Ch5-Debugging.vcxproj.filters
index 3a09495..a9fa5af 100644
--- a/CST116-Ch5-Debugging/CST116-Ch5-Debugging.vcxproj.filters
+++ b/CST116-Ch5-Debugging/CST116-Ch5-Debugging.vcxproj.filters
@@ -15,7 +15,7 @@
</Filter>
</ItemGroup>
<ItemGroup>
- <ClCompile Include="Project1.cpp">
+ <ClCompile Include="Part2.cpp">
<Filter>Source Files</Filter>
</ClCompile>
</ItemGroup>
diff --git a/CST116-Ch5-Debugging/Part2.cpp b/CST116-Ch5-Debugging/Part2.cpp
new file mode 100644
index 0000000..2796a5c
--- /dev/null
+++ b/CST116-Ch5-Debugging/Part2.cpp
@@ -0,0 +1,134 @@
+
+// Musa Ahmed [email protected]
+
+#include <iostream>
+#include <iomanip>
+#include <string>
+#include <list>
+#include <bitset>
+#include <vector>
+#include <math.h>
+
+
+using std::cout;
+using std::ios;
+using std::cin;
+using std::endl;
+using std::string;
+using std::to_string;
+
+int main()
+{
+ // All the name strings
+ string n1;
+ string n2;
+ string n3;
+ string n4;
+
+
+ // all the income floats
+ float c1;
+ float c2;
+ float c3;
+ float c4;
+
+ // All the age ints
+ int a1;
+ int a2;
+ int a3;
+ int a4;
+
+ // spacer for all values on table
+ int spacer;
+
+
+ // Ask user for first input
+ cout << "Enter a Name: " << endl;
+ cin >> n1;
+ cout << "Enter a Age: " << endl;
+ cin >> a1;
+ cout << "Enter an Income: " << endl;
+ cin >> c1;
+
+
+ // Ask user for second input
+ cout << "Enter a Name: " << endl;
+ cin >> n2;
+ cout << "Enter a Age: " << endl;
+ cin >> a2;
+ cout << "Enter an Income: " << endl;
+ cin >> c2;
+
+
+ // Ask user for third input
+ cout << "Enter a Name: " << endl;
+ cin >> n3;
+ cout << "Enter a Age: " << endl;
+ cin >> a3;
+ cout << "Enter an Income: " << endl;
+ cin >> c3;
+
+
+ // Aks user for fourth input
+ cout << "Enter a Name: " << endl;
+ cin >> n4;
+ cout << "Enter a Age: " << endl;
+ cin >> a4;
+ cout << "Enter an Income: " << endl;
+ cin >> c4;
+
+
+ // PART 2
+
+// Average all the lengths of the names and use this as the spacer
+ spacer = (n1.size() + n2.size() + n3.size() + n4.size()) / 4 + 5;
+
+ // Display the headers of the table
+ cout.setf(ios::left);
+ cout.width(spacer);
+ cout << "Name";
+ cout.width(spacer);
+ cout << "Age";
+ cout.width(spacer);
+ cout << "Income" << endl;
+ cout.precision(3);
+
+ // Display the first profile
+ cout.width(spacer);
+ cout << n1;
+ cout.width(spacer);
+ cout.precision(3);
+ cout << a1;
+ cout.width(spacer);
+ cout << c1 << endl;
+
+ // Display the first profile
+ cout.width(spacer);
+ cout << n2;
+ cout.width(spacer);
+ cout.precision(3);
+ cout << a2;
+ cout.width(spacer);
+ cout << c2 << endl;
+
+ // Display the first profile
+ cout.width(spacer);
+ cout << n3;
+ cout.width(spacer);
+ cout.precision(3);
+ cout << a3;
+ cout.width(spacer);
+ cout << c3 << endl;
+
+ // Display the first profile
+ cout.width(spacer);
+ cout << n4;
+ cout.width(spacer);
+ cout.precision(3);
+ cout << a4;
+ cout.width(spacer);
+ cout << c4 << endl;
+
+
+ return 0;
+} \ No newline at end of file
diff --git a/CST116-Ch5-Debugging/Project1.cpp b/CST116-Ch5-Debugging/Project1.cpp
deleted file mode 100644
index 593f4f1..0000000
--- a/CST116-Ch5-Debugging/Project1.cpp
+++ /dev/null
@@ -1,112 +0,0 @@
-
-#include <iostream>
-#include <iomanip>
-#include <string>
-#include <list>
-#include <bitset>
-#include <vector>
-#include <math.h>
-
-using namespace std;
-using std::cout;
-using std::cin;
-using std::endl;
-using std::string;
-using std::to_string;
-
-int main()
-{
- // All the name strings
- string n1;
- string n2;
- string n3;
- string n4;
-
- // All the gpa floats
- float g1;
- float g2;
- float g3;
- float g4;
-
- // all the income ints
- int c1;
- int c2;
- int c3;
- int c4;
-
- // spacer for all values on table
- int spacer;
-
-
- // Ask user for first input
- cout << "Enter a Name: " << endl;
- cin >> n1;
- cout << "Enter a GPA: " << endl;
- cin >> g1;
- cout << "Enter an Income: " << endl;
- cin >> c1;
-
-
- // Ask user for second input
- cout << "Enter a Name: " << endl;
- cin >> n2;
- cout << "Enter a GPA: " << endl;
- cin >> g2;
- cout << "Enter an Income: " << endl;
- cin >> c2;
-
-
- // Ask user for third input
- cout << "Enter a Name: " << endl;
- cin >> n3;
- cout << "Enter a GPA: " << endl;
- cin >> g3;
- cout << "Enter an Income: " << endl;
- cin >> c3;
-
-
- // Aks user for fourth input
- cout << "Enter a Name: " << endl;
- cin >> n4;
- cout << "Enter a GPA: " << endl;
- cin >> g4;
- cout << "Enter an Income: " << endl;
- cin >> c4;
-
-
- // Average all the lengths of the names and use this as the spacer
- spacer = (n1.size() + n2.size() + n3.size() + n4.size()) / 4 + 5;
-
- // Display the headers of the table
- cout << left << setw(spacer) << "Name"
- << left << setw(spacer) << "GPA"
- << left << setw(spacer) << "Income"
- << endl;
-
- // Display the first profile
- cout << left << setw(spacer) << n1 << " "
- << left << setw(spacer) << setprecision(3) << g1
- << left << setw(spacer) << c1
- << endl;
-
- // Display the second profile
- cout << left << setw(spacer) << n2 << " "
- << left << setw(spacer) << setprecision(3) << g2
- << left << setw(spacer) << c2
- << endl;
-
- // Display the third profile
- cout << left << setw(spacer) << n3 << " "
- << left << setw(spacer) << setprecision(3) << g3
- << left << setw(spacer) << c3
- << endl;
-
- // Display the fourth profile
- cout << left << setw(spacer) << n4 << " "
- << left << setw(spacer) << setprecision(3) << g4
- << left << setw(spacer) << c4
- << endl;
-
-
- return 0;
-} \ No newline at end of file