100% tevredenheidsgarantie Direct beschikbaar na je betaling Lees online óf als PDF Geen vaste maandelijkse kosten
logo-home
The Body Mass Index Program and Matric Certificate Program, Compulsory assignments $10.92
In winkelwagen

Overig

The Body Mass Index Program and Matric Certificate Program, Compulsory assignments

 0 keer verkocht
  • Vak
  • Instelling

Assignments 2 and 3 in Mat1503 deal with vectors and determinants ,particularly helpful for engineering and computer science students who will apply these principles in real life through the design of efficient search engine algorithms (matrices and determinants ) and safer vehicles (vectors) ...

[Meer zien]

Voorbeeld 2 van de 11  pagina's

  • 9 november 2022
  • 11
  • 2022/2023
  • Overig
  • Onbekend
avatar-seller
Shivam_12596388_Assignment 2_uniqueCode_830369



Question 1 COS1511 Assignment 2: Writing Function headers in C++

Part (i): The function that returns no value from the caller
void check(int param1,float param2)
{
param1>param2;
param2=param1;
param2<param1;

}




Part (ii): The function that multiplies two values and returns the result:
void mult(float var1,float var2)
{
cout<<var1*var2;
}
int main()
{
mult(2,3);

return 0;

}




Part (iii): The function that tells you how many seconds, minutes and hours are in a day
void time(int seconds, int minutes,int hours)
{
cout<<"Within a day there are
"<<seconds<<"seconds,”<<minutes<<”minutes”<<hours<<”hours in a day
“<<endl<<endl;
}
int main()
{
time (60,60,24,);
return 0;
}

, Shivam_12596388_Assignment 2_uniqueCode_830369



Part (iv): The function that counts the amount of characters in a given string (phrase or sentence)

void countChar (string phraseofCharacters,int TotalCharacters)
{

phraseofCharacters="MonkeyBanana";

TotalCharacters=12;

cout<<"The phrase "<<phraseofCharacters<< " has "
<<TotalCharacters<< "Characters in the phrase
"<<phraseofCharacters<<endl<<endl<<endl;

}
int main ()
{
countChar( "MonkeyBanana",12 );

return 0;
}




Question 2 COS1511 Assignment 2: Debugging Errors in functions

Correcting errors in output code 2i

To call a function, simply do the following;
int main()
{
function1();

return 0;
}

Do not do the following in terms of calling functions

a) endl; int function2()

b) cout << "Inside function function1 " << endl;

Do the following to correct the above errors when calling functions in C++

• Always include the function you created within the main function within the default int
main () function.

• Never include endl;when ending functions , simply use the {} to end functions

• You cannot call a function without stating it in int main()

Dit zijn jouw voordelen als je samenvattingen koopt bij Stuvia:

Bewezen kwaliteit door reviews

Bewezen kwaliteit door reviews

Studenten hebben al meer dan 850.000 samenvattingen beoordeeld. Zo weet jij zeker dat je de beste keuze maakt!

In een paar klikken geregeld

In een paar klikken geregeld

Geen gedoe — betaal gewoon eenmalig met iDeal, creditcard of je Stuvia-tegoed en je bent klaar. Geen abonnement nodig.

Direct to-the-point

Direct to-the-point

Studenten maken samenvattingen voor studenten. Dat betekent: actuele inhoud waar jij écht wat aan hebt. Geen overbodige details!

Veelgestelde vragen

Wat krijg ik als ik dit document koop?

Je krijgt een PDF, die direct beschikbaar is na je aankoop. Het gekochte document is altijd, overal en oneindig toegankelijk via je profiel.

Tevredenheidsgarantie: hoe werkt dat?

Onze tevredenheidsgarantie zorgt ervoor dat je altijd een studiedocument vindt dat goed bij je past. Je vult een formulier in en onze klantenservice regelt de rest.

Van wie koop ik deze samenvatting?

Stuvia is een marktplaats, je koop dit document dus niet van ons, maar van verkoper shivamnaik. Stuvia faciliteert de betaling aan de verkoper.

Zit ik meteen vast aan een abonnement?

Nee, je koopt alleen deze samenvatting voor $10.92. Je zit daarna nergens aan vast.

Is Stuvia te vertrouwen?

4,6 sterren op Google & Trustpilot (+1000 reviews)

Afgelopen 30 dagen zijn er 63950 samenvattingen verkocht

Opgericht in 2010, al 15 jaar dé plek om samenvattingen te kopen

Begin nu gratis

Laatst bekeken door jou


$10.92
  • (0)
In winkelwagen
Toegevoegd