aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMiles-Cell <[email protected]>2024-03-04 13:12:27 -0800
committerMiles-Cell <[email protected]>2024-03-04 13:12:27 -0800
commitab2d61c0193d7d14f2f286b0310627a283087ce6 (patch)
treeeaea9e30fa9585afeb73d8a910d31fa396a19b92
parentExercise complete. (diff)
downloadhomework-5-miles-cell-develop.tar.xz
homework-5-miles-cell-develop.zip
Exercise corrected. Pushing.develop
-rw-r--r--Homework 5/Homework 5/Contacts.cpp47
-rw-r--r--Homework 5/Homework 5/Contacts.h18
-rw-r--r--Homework 5/Homework 5/program.cpp55
3 files changed, 18 insertions, 102 deletions
diff --git a/Homework 5/Homework 5/Contacts.cpp b/Homework 5/Homework 5/Contacts.cpp
index 284eeee..077ae84 100644
--- a/Homework 5/Homework 5/Contacts.cpp
+++ b/Homework 5/Homework 5/Contacts.cpp
@@ -6,45 +6,8 @@ using std::cin;
using std::endl;
-Contact InputNewContacts()
-{
- Contact newContact = {};
-
- cout << "Name: ";
- cin >> newContact.Name;
-
- cout << "Email: ";
- cin >> newContact.Email;
-
- cout << "Street Address: ";
- cin >> newContact.StreetAddress;
-
- cout << "City: ";
- cin >> newContact.City;
-
- cout << "State: ";
- cin >> newContact.State;
-
- cout << "Zip: ";
- cin >> newContact.Zip;
-
- return newContact;
-}
-
-void PrintContacts(Contact(&contacts)[10])
-{
- for (auto &x : contacts)
- {
- cout << "\nName: " << x.Name << endl;
-
- cout << "\nEmail: " << x.Email << endl;
-
- cout << "\nStreet Address: " << x.StreetAddress << endl;
-
- cout << "\nCity: " << x.City << endl;
-
- cout << "\nState: " << x.State << endl;
-
- cout << "\nZip: " << x.Zip << endl;
- }
-}
+int noParams();
+int sum(int a, int b);
+float percentage(int i, int j);
+float fahrenheitToCelsius(float f);
+float celsiusToFahrenheit(float c); \ No newline at end of file
diff --git a/Homework 5/Homework 5/Contacts.h b/Homework 5/Homework 5/Contacts.h
index eadf34d..c3fa3a4 100644
--- a/Homework 5/Homework 5/Contacts.h
+++ b/Homework 5/Homework 5/Contacts.h
@@ -1,20 +1,12 @@
#ifndef CONTACTS_H
#define CONTACTS_H
-struct Contact
-{
- char Name[25] = {};
- char Email[100] = {};
- char StreetAddress[35] = {};
- char City[30] = {};
- char State[25] = {};
- int Zip = 0;
+int noParams();
+int sum(int a, int b);
+float percentage(int i, int j);
+float fahrenheitToCelsius(float f);
+float celsiusToFahrenheit(float c);
-};
-
-Contact InputNewContacts();
-
-void PrintContacts(Contact(&contacts)[10]);
#endif // !CONTACTS_H
diff --git a/Homework 5/Homework 5/program.cpp b/Homework 5/Homework 5/program.cpp
index b2388e3..50d1ee1 100644
--- a/Homework 5/Homework 5/program.cpp
+++ b/Homework 5/Homework 5/program.cpp
@@ -13,54 +13,15 @@ using std::cout;
using std::cin;
using std::endl;
+int main() {
+ int a = 5, b = 10;
+ float temperatureF = 98.6, temperatureC = 37.0;
-const int MAX = 10;
+ std::cout << "No parameters function returns: " << noParamsFunction() << std::endl;
+ std::cout << "Sum of " << a << " and " << b << " is: " << sum(a, b) << std::endl;
+ std::cout << "Percentage of " << a << " to " << b << " is: " << percentage(a, b) << "%" << std::endl;
+ std::cout << temperatureF << "F is " << fahrenheitToCelsius(temperatureF) << "C" << std::endl;
+ std::cout << temperatureC << "C is " << celsiusToFahrenheit(temperatureC) << "F" << std::endl;
-
-int main()
-{
-#include "Contacts.h"
-
- Contact contacts[MAX] = {};
- int numberOfContacts = 0;
-
- char c = 'n';
-
- do {
- system("cls");
- cout << "A: Input New Contact\n";
- cout << "B: Update Contact\n";
- cout << "C: Print Contacts\n";
- cout << "Press 'x' to Exit\n";
-
- std::cin >> c;
- switch (c)
- {
- case 'A':
- contacts[numberOfContacts] = InputNewContacts();
- numberOfContacts++;
- break;
-
- case 'B':
- //Pick a contact, then update with new info;
- //Print the contacts with element #
- //Prompt for user to input element #
- //Pass that Contact to a function to update
- break;
-
- case 'C':
- //Print the contacts
- //Loop through the contacts, printing real contacts.
- break;
-
- case 'x':
- //exit
- break;
-
- default:
- cout << "\nThat was a bad input\n";
- }
- } while (c != 'x');
return 0;
}
-