1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
Anna007 [38]
3 years ago
9

Create a function names minElement() that takes an array of numbers as a paaramter and returns the min value of the array. The a

rray may not be modified by the function. The array method .sort() may not be used. The function must loop through the array
Computers and Technology
1 answer:
Vika [28.1K]3 years ago
8 0

Answer:

#include<iostream>

using namespace std;

//create the function

int minElement(int arr[],int n){

   int minimum = arr[0];  //store the first value of array

   //for loop for iterate the each element

   for(int i=0;i<n;i++){

       if(arr[i]<minimum){   //compare

           minimum=arr[i];

       }

   }

   return minimum;

}

int main(){

   int arr[]={4,1,7,9,2,6};

   int array_size = 6;

   int result = minElement(arr,array_size);   //calling

   cout<<"The min value is: "<<result<<endl;

}

Explanation:

First include the library iostream in the c++ programming for input/output.

then, create the function minElement() for find the minimum value in the array.

it required the one loop for iterate the each element in the array and then compare with first element in the array which is store in the variable minimum.

if array element is less than the minimum then, update the value in the minimum variable.

after complete the loop, return the result.

for capture the result create the main function and call the function with parameter array.

and finally display the result.

You might be interested in
What would be the most popular piece of technology on Earth?
spin [16.1K]

Answer:

the smart phone

Explanation:

It is the most widley used and accepted

8 0
3 years ago
Read 2 more answers
Design and implement a class dayType that implements the day of the week in a program. The class dayType should store the day, s
Afina-wow [57]

The code is implemented based on the given operations.

Explanation:

#include <iostream>

#include <string>

using namespace std;

class dayType

{ private:

 string day[7];

 string presentDay;

 int numofDays;

public:

 void setDay(string freshDay);

 void printDay() const;

 int showDay(int &day);

 int nextDay(int day);

 int prevDay(int day) const;

 int calcDay(int day, int numofDays);    

 dayType()

 {

  day[0] = "Sunday";

  day[1] = "Monday";

  day[2] = "Tuesday";

  day[3] = "Wednesday";

  day[4] = "Thursday";

  day[5] = "Friday";

  day[6] = "Saturday";

  presentDay = day[0];

  numofDays = 0;

 };

 ~dayType();

};

#endif

#include "dayType.h"

void dayType::setDay(string freshDay)

{

  presentDay = freshDay;

}

void dayType::printDay()

{

  cout << "Day chosen is " << presentDay << endl;

}

int dayType::showDay(int& day)

{

  return day;

}

int dayType::nextDay(int day)

{

day = day++;

if (day > 6)

 day = day % 7;

switch (day)

{

case 0: cout << "The successive day is Sunday";

 break;

case 1: cout << "The successive day is Monday";

 break;

case 2: cout << "The successive day is Tuesday";

 break;

case 3: cout << "The successive day is Wednesday";

 break;

case 4: cout << "The successive day is Thursday";

 break;

case 5: cout << "The successive day is Friday";

 break;

case 6: cout << "The successive day is Saturday";

 break;

}

cout << endl;

return day;

}

 

int dayType::prevDay(int day)

{

day = day--;

switch (day)

{

case -1: cout << "The before day is Saturday.";

 break;

case 0: cout << "The before day is Saturday.";

 break;

case 1: cout << "The before day is Saturday.";

 break;

case 2: cout << "The before day is Saturday.";

 break;

case 3: cout << "The before day is Saturday.";

 break;

case 4: cout << "The before day is Saturday.";

 break;

case 5: cout << "The before day is Saturday.";

 break;

default: cout << "The before day is Saturday.";

}

cout << endl;

return day;

}

int dayType::calcDay(int addDays, int numofDays)

{

addDay = addDays + numofDays;

if (addDay > 6)

 addDay = addDay % 7;

switch(addDay)

{

case 0: cout << "The processed day is Sunday.";

 break;

case 1: cout << "The processedday is Monday.";

 break;

case 2: cout << "The processedday is Tuesday.";

 break;

case 3: cout << "The processedday is Wednesday.";

 break;

case 4: cout << "The processedday is Thursday.";

 break;

case 5: cout << "The processedday is Friday.";

 break;

case 6: cout << "The processedday is Saturday.";

 break;

default: cout << "Not valid choice.";

}

cout << endl;

return addDays;

}

4 0
3 years ago
In 1997, two South Korean manufacturers of semiconductors, LG Semicon and Hyundai Electronics, were accused of selling dynamic r
KatRina [158]

Answer:

<em>d. dumping.</em>

Explanation:

In international trade, dumping is described loosely as <em>selling products on  a foreign market below their manufacturing expenses or selling products on  a foreign market below their ' reasonable ' market value</em>.

It is a form of injury pricing, a difference in cost aimed at harming the competition.

4 0
3 years ago
Write a function that takes a string like 'one five two' and returns the corresponding integer (in this case, 152). A function j
Lelu [443]

Answer:

see explaination

Explanation:

def words2number(s):

words = s.split()

numbers = ['zero', 'one', 'two', 'three', 'four', 'five', 'six', 'seven', 'eight', 'nine']

result = ""

for word in words:

if word in numbers:

result += str(numbers.index(word))

return result

4 0
3 years ago
Read 2 more answers
A qualifier distinguishes the set of objects at the far end of the association based on the qualifier value.
Andrei [34K]

Answer:

True

Explanation: A qualifier is a term used in IT(information technology) and computer software. It is used to differentiate/ identify and select different sets of objects that are located at the far ends of a qualifier association.

A qualifier is usually used to identify an object from a set of closely related and similar objects, they are usually small boxes possibly with a rectangular shape.

7 0
2 years ago
Other questions:
  • The critical path of a network is the A. shortest time path through the network. B. path with the most activities. C. longest ti
    8·1 answer
  • Write a method swaparrayends() that swaps the first and last elements of its array parameter. ex: sortarray = {10, 20, 30, 40} b
    15·1 answer
  • Why it’s important to keep the standard internet protocol TCP/IP?
    11·1 answer
  • When a JSP page is compiled, what is it turned into?
    11·1 answer
  • In addition to telling you which programs are currently running, what other information does the task bar display
    10·1 answer
  • How should a Salesforce Admin fulfill those requirements? Universal Containers launches a Partner Community for their resellers
    13·1 answer
  • What are the most commonly found items in the trash according to the Municipal Solid Waste report?
    12·2 answers
  • IN WHICH COUNTRY DO THEY LET YOU PLAY MINECRAFT IN SCHOOL?
    8·2 answers
  • Wendell notices that the company's top executives share a belief that managers are directly responsible for the organization's s
    13·1 answer
  • Can somebody please help me with these few questions?
    11·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!