answer.
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
jeyben [28]
2 years ago
3

Use function GetUserInfo to get a user's information. If user enters 20 and Holly, sample program output is:Holly is 20 years ol

d. #include #include void GetUserInfo(int* userAge, char userName[]) { printf("Enter your age: \n"); scanf("%d", userAge); printf("Enter your name: \n"); scanf("%s", userName); return;}int main(void) { int userAge = 0; char userName[30] = ""; /* Your solution goes here */ printf("%s is %d years old.\n", userName, userAge); return 0;}
Computers and Technology
1 answer:
ehidna [41]2 years ago
8 0

Answer:

Replace

/*Your solution goes here*/

with

GetUserInfo(&userAge, userName);

And Modify:

printf("%s is %d years old.\n", userName, userAge)

to

printf("%s is %d years old.", &userName, userAge);

Explanation:

The written program declares userAge as pointer;

This means that the variable will be passed and returned as a pointer.

To pass the values, we make use of the following line:

GetUserInfo(&userAge, userName);

And to return the value back to main, we make use of the following line

printf("%s is %d years old.", &userName, userAge);

The & in front of &userAge shows that the variable is declared, passed and returned as pointer.

The full program is as follows:

<em>#include <stdio.h></em>

<em>#include <string.h></em>

<em>void GetUserInfo(int* userAge, char userName[]) { </em>

<em>    printf("Enter your age: "); </em>

<em>    scanf("%d", userAge); </em>

<em>    printf("Enter your name: "); </em>

<em>    scanf("%s", userName); </em>

<em>    return;</em>

<em>}</em>

<em>int main(void) { </em>

<em>    int* userAge = 0; </em>

<em>    char userName[30] = ""; </em>

<em>    GetUserInfo(&userAge, userName);</em>

<em>    printf("%s is %d years old.", &userName, userAge); </em>

<em>    return 0;   </em>

<em>}</em>

You might be interested in
Anna bought a box of blueberries for £7. She used 700 grams for a cheesecake and she has 450 grams left. How much did the bluebe
xxTIMURxx [149]

0.61 (rounded up)

Explanation:

You add both 700 and 450 which will give you 1150g

You then divide 1150 by 100 which gives you 11.5

Then divide 7 by 11.5 which will give you 0.61 as cost of every 100 grams

8 0
2 years ago
Using Amdahl’s Law, calculate the speedup gain of an application that has a 60 percent parallel component for (a) two processing
Nina [5.8K]

Answer:

a) Speedup gain is 1.428 times.

b) Speedup gain is 1.81 times.

Explanation:

in order to calculate the speedup again of an application that has a 60 percent parallel component using Anklahls Law is speedup which state that:

t=\frac{1 }{(S + (1- S)/N) }

Where S is the portion of the application that must be performed serially, and N is the number of processing cores.

(a) For N = 2 processing cores, and a 60%, then S = 40% or 0.4

Thus, the speedup is:

t = \frac{1}{(0.4 + (1-0.4)/2)} =1428671

Speedup gain is 1.428 times.

(b) For N = 4 processing cores and a 60%, then S = 40% or 0.4

Thus, the speedup is:

t=\frac{1}{(0.4 + (1-0.4)/4)} = 1.8181

Speedup gain is 1.81 times.

8 0
2 years ago
After running the following pseudocode, what will the value of VARIABLE be? 1. Set value of VARIABLE to 5 2. Increase the value
Nutka1998 [239]

Answer:

10

Explanation:

you start with 5       5

you add 3                8

the variable is not odd so skip         8

the variable is even so add 1            9

the variable is odd so add 1              10

10

hope this helps <3

8 0
2 years ago
A homeowner uses a smart assistant to set the house alarm, get packages delivery updates, and set time on the outdoor lights. Wh
ch4aika [34]

The example where the alarm of the house set up, delivery updated should be provided, etc should represent the function example of the artificial intelligence.

The following information related to artificial intelligence is:

  • It refers to the human intelligence where the machines could be treated as humans and according to this, the actions should be mimic.
  • It should be used for any kind of machine where the traits should be associated along with the mind of the human-like for learning & problem-solving purpose.

Therefore we can conclude that The example where the alarm of the house set up, delivery updated should be provided, etc should represent the function example of the artificial intelligence.

Learn more about the machine here: brainly.com/question/2555822

3 0
2 years ago
Checkpoint 7.61 Write the prototype for a function named showSeatingChart that will accept the following two-dimensional array a
Kobotan [32]

Answer:

void showSeatingChart(const string [][COLS], int);

Explanation:

void showSeatingChart(const string [][COLS], int);

The above function showSeatingChart() will display the 2D array of seating chart.

The return type of this function is void because it does not need to retun anything.

The parameter of the function is a 2D array which is seatingChart[ROWS][COLS].

The type of this 2D array is string that means it is a 2D array of string. It will contain string elements.

To declare a prototype of a function, there should be a semi-colon (;) at the end of declaration.

The definition of the function should be given outside main() function and declaration of the function should be above the main() function or at the beginning of the program with declaration of constant variables.

7 0
2 years ago
Read 2 more answers
Other questions:
  • Janice is unsure about her future career path she has grown up on her family farm but she is also interested in medicine Janice
    5·1 answer
  • You live "out in the middle of nowhere" and feel there is no need to protect your internet connection because there is no one th
    5·1 answer
  • Carrie works on a help desk and is assigned a ticket that was automatically generated by a server because of an error. The error
    14·2 answers
  • You are on vacation and want to see where all the restaurants and trendy shops are in relation to your hotel. You remember there
    15·1 answer
  • Flesh out the body of the print_seconds function so that it prints the total amount of seconds given the hours, minutes, and sec
    7·1 answer
  • What is the name of the program file that you can enter in the Windows search or Run box to execute Event Viewer? What process i
    12·1 answer
  • What happened if the offshore team members are not able to participate in the iterations demo due to timezone/infrastructure iss
    12·1 answer
  • A form of artificial intelligence that can perform many complex, _______ tasks. Select one: a. serialized b. repetitive c. non-r
    7·1 answer
  • The new Director of Information Technology has asked you to recommend a strategy to upgrade the servers on their network. Recomm
    9·1 answer
  • For a data structure, such as a stack, who is responsible for throwing an exception if the stack is empty and a pop() is called:
    13·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!