100% satisfaction guarantee Immediately available after payment Both online and in PDF No strings attached
logo-home
COS1511 Assignment 01 Solutions R70,00   Add to cart

Other

COS1511 Assignment 01 Solutions

 8 views  0 purchase

Here you will find all the solutions to COS1511 assignment 01.

Preview 2 out of 8  pages

  • April 16, 2022
  • 8
  • 2021/2022
  • Other
  • Unknown
All documents for this subject (83)
avatar-seller
segodithabang
COS1511 ASSIGNMENT 01
UNIQUE NUMBER: 830138


Question 1.
#include <iostream>
using namespace std;
int main()
{
int mFactor;
cout << "Please enter the factor to multiply the ingredients with :";
cin >> mFactor;
cout << "Recipe name" << endl;
cout << "\tIngredients" << endl;
cout << "\t\t" << 1*mFactor << " cups of all purpose flour" << endl;
cout << "\t\t" << 2*mFactor << " tablespoons of white sugar" << endl;
cout << "\t\t" << 2*mFactor << " teaspoons of baking powder" << endl;
cout << "\t\t" << 1*mFactor << " teaspoons of salt" << endl;
cout << "\t\t" << 1*mFactor << " egg" << endl;
cout << "\t\t" << 2*mFactor << " tablespoons of sunflower seed/olive oil" << endl;
cout << "\t\t" << 1*mFactor << " cups of milk" << endl;
cout << "\tMethod" << endl;
cout << "\t\tStep 1: Mix flour, sugar, baking powder and salt in a large bowl." << endl;
cout << "\t\tStep 2: Make a hole in the center of the bowl, which has all the mixed ingredients." <<
endl;
cout << "\t\tStep 3: Now pour the milk, beaten egg and oil in the centre of the bowl, and then mix
everything until it is smooth." << endl;
cout << "\t\tStep 4: Lightly pour oil on a frying pan, and heat the frying pan with medium high heat
on a stove." << endl;
cout << "\t\tStep 5: Pour/scoop the mixture on the frying pan, using approximately a quarter (1/4)
of a cup for each pancake." << endl;
cout << "\t\tStep 5: Flip then remove the pancake when it is brown on both sides (note: they
should not burn or turn black)" << endl;
cout << "\t\tStep 6: Recommend to SERVE WHILE IT IS HOT!!!" << endl;
return 0;
}

, Question 2.
#include <iostream>
using namespace std;
int main()
{
int nrPupils = 56, nrGroups, nrLeft, groupSize;
cout << "Please enter the size of each group: " << endl;
cin >> groupSize;
nrGroups = nrPupils/groupSize;
nrLeft = nrPupils - nrGroups*groupSize;
cout << "There are " << nrGroups << " groups consisting of " << groupSize << " pupils. There are "
<< nrLeft << " remaining pupils." << endl;
return 0;
}




Question 3.
#include <iostream>
#include <iomanip>
using namespace std;
int main()
{
float var1, var2;
char operation;
cout << "Please enter the first float value: ";
cin >> var1;
cout << "Please enter the second float value: ";
cin >> var2;
cout << "Please enter the operation required: ";
cin >> operation;
cout << setiosflags(ios::fixed) << setprecision(2);
if (operation == '+')
cout << "The sum of " << var1 << " and " << var2 << " is " << var1+var2 << endl;
else if (operation == '-')
cout << "The difference of " << var1 << " and " << var2 << " is " << var1-var2 << endl;
else if (operation == 'x')
cout << "The multiplication of " << var1 << " and " << var2 << " is " << var1*var2 << endl;
else if (operation == '/')
cout << "The division of " << var1 << " and " << var2 << " is " << var1/var2 << endl;
else if (operation == '%')
cout << "The modulus of " << var1 << " and " << var2 << " is " << (static_cast<int32_t>(var1))%
(static_cast<int32_t>(var2)) << endl;

The benefits of buying summaries with Stuvia:

Guaranteed quality through customer reviews

Guaranteed quality through customer reviews

Stuvia customers have reviewed more than 700,000 summaries. This how you know that you are buying the best documents.

Quick and easy check-out

Quick and easy check-out

You can quickly pay through EFT, credit card or Stuvia-credit for the summaries. There is no membership needed.

Focus on what matters

Focus on what matters

Your fellow students write the study notes themselves, which is why the documents are always reliable and up-to-date. This ensures you quickly get to the core!

Frequently asked questions

What do I get when I buy this document?

You get a PDF, available immediately after your purchase. The purchased document is accessible anytime, anywhere and indefinitely through your profile.

Satisfaction guarantee: how does it work?

Our satisfaction guarantee ensures that you always find a study document that suits you well. You fill out a form, and our customer service team takes care of the rest.

Who am I buying this summary from?

Stuvia is a marketplace, so you are not buying this document from us, but from seller segodithabang. Stuvia facilitates payment to the seller.

Will I be stuck with a subscription?

No, you only buy this summary for R70,00. You're not tied to anything after your purchase.

Can Stuvia be trusted?

4.6 stars on Google & Trustpilot (+1000 reviews)

73918 documents were sold in the last 30 days

Founded in 2010, the go-to place to buy summaries for 14 years now

Start selling
R70,00
  • (0)
  Buy now