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
Ivenika [448]
3 years ago
7

Define a function SetTime, with int parameters hoursVal and minutesVal, that returns a struct of type TimeHrMin. The function sh

ould assign TimeHrMin's data member hours with hoursVal and minutes with minutesVal.
Computers and Technology
1 answer:
Lapatulllka [165]3 years ago
4 0

Answer:

#include <stdio.h>

typedef struct TimeHrMin_struct //struct

{

int hours;

int minutes;

} TimeHrMin;

struct TimeHrMin_struct SetTime(int hoursVal,int minutesVal) //SetTime function

{

struct TimeHrMin_struct str;

str.hours=hoursVal; //assigning the values

str.minutes=minutesVal;

return str; //returning the struct

}

int main(void)

{

TimeHrMin studentLateness;

int hours;

int minutes;

scanf("%d %d", &hours, &minutes);

studentLateness = SetTime(hours, minutes); //calling the function

printf("The student is %d hours and %d minutes late.\n", studentLateness.hours, studentLateness.minutes);

return 0;

}

Explanation:

You might be interested in
A pair is a simple struct with two data members, one of type T1 and one of type T2. A set and a map are organized as binary sear
madam [21]

Answer:

(e) unordered_map<string, unordered_set<int>>

The outer unordered_map is a hash table, so to search the course c it would take constant time O(1). and once we have the course and its unordered_set , which is again a hash table so to serach the student s it would take constant time O(1).So total time is O(1), constant.

(f) map<string, set<int>>

The outer map is a binary search tree, so to search the course c it would take logC time and once we have the course and its set, which is a binary tree, to list the ids in sorted order we need to do an inorder traversal of the tree that would take O(S) time.So total time is O(logC+S)

(g) unordered_map<string, unordered_set<int>>

The outer unordered_map is a hash table, so to search the course c it would take constant time O(1). and once we have the course and its onordered_set , which is another hash table, to list the ids in sorted order we need to loop through all elements in the hash table which takes O(S) time and sort them using any sorting algorithms or else construct another container set<int> that takes O(SlogS) time. So total time is O(SlogS).

(h) unordered_map<string, set<int>>

The outer unordered_map is a hash table, so we loop through each course in it and do search for the student s in its set<int>, which is a binary search tree, if found we print the course else not. The search takes logS time for each course, so total time is O(ClogS).

7 0
3 years ago
Debug the code in the main method of this class, which is intended to initialize an array named arr to hold 3 ints, fill this wi
pentagon [3]

Answer:

import java.util.Scanner;

public class U6_L1_Activity_One{

 public static void main(String[] args){

   Scanner scan = new Scanner(System.in);

   int[] arr = new int[4];

   arr[1] = scan.nextInt();

   arr[2] = scan.nextInt();

   arr[3] = scan.nextInt();

   System.out.println("Contents: " + arr[1] + " " + arr[2] + " " + arr[3]);

   int Sum = (1 + 2 + 3);

   System.out.println("Sum: " + Sum);

 }

}

Explanation:

5 0
3 years ago
Which operating system became obsolete with the arrival of more advanced graphical user interfaces
Alexandra [31]

Answer:

Single User/ Single Tasking Operating System

8 0
4 years ago
The radix sort
Taya2010 [7]

Answer:

A.Treats array entries as if they were strings that have same length.

Explanation:

The radix sort treats the array values as the strings.First it compares the LSB(Least Significant Bit) of the array values and then moves to the right one by one upto MSB(Most Significant Bit).So we can say that the radix sort treats the entries of the array as strings and compare them.So the answer is option A.

4 0
4 years ago
Windows OS and Mac OS are examples of which type of operating system?
german
Windows OS and Mac OS are examples of single user, multi tasking Operating Systems.
5 0
4 years ago
Read 2 more answers
Other questions:
  • The term median means
    9·2 answers
  • What hex value is the standard indicator for jpeg graphics files?​?
    6·1 answer
  • Cliff just started working with a client who has a very disorganized AdWords account. What’s an effective way for him to begin r
    15·1 answer
  • Which of the following terms is computed as cash provided by operations less capital expenditures and cash dividends? A : adjust
    5·1 answer
  • How do assembly language different from machine language?
    15·1 answer
  • 1) Prompt the user to enter two words and a number, storing each into separate variables. Then, output those three values on a s
    11·1 answer
  • I need help with the last question pleasee help me guys .
    11·2 answers
  • Suppose we want an error correcting code that will allow all single-bit errors to be corrected for memory words of length 15. 1.
    5·1 answer
  • Explain the working principle of computer with suitable diagram​
    15·1 answer
  • This was the template given for my assignment: class Login:
    14·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!