subject

1)create a conditional expression that evaluates to string "negative" if userval is less than 0, and "positive" otherwise. example output when userval = -9 for the below sample program:
-9 is negative.
#include
#include
int main(void) {
char condstr[50] = "";
int userval = 0;
userval = -9;
strcpy(condstr, /* your solution goes here */);
printf("%d is %s.
", userval, condstr);
return 0;
}
2)
using a conditional expression, write a statement that increments numusers if updatedirection is 1, otherwise decrements numusers. ex: if numusers is 8 and updatedirection is 1, numusers becomes 9; if updatedirection is 0, numusers becomes 7. hint: start with "numusers = ".
#include
int main(void) {
int numusers = 0;
int updatedirection = 0;
numusers = 8;
updatedirection = 1;
/* your solution goes here */
printf("new value is: %d
", numusers);
return 0;

ansver
Answers: 1

Another question on Computers and Technology

question
Computers and Technology, 22.06.2019 07:00
You will be given two character arrays of the same size, one will contain a number of ships. ships will move around the character array based on which way they are facing and the route they are on. routes are given in the other array. the route consists of '-' and '|' for straight paths, '\' and '/' for curves, and '+' for intersections. there are ships on these routes. ships always face a direction, '^' for up, '> ' for right, 'v' for down, and '< ' for left. any time the ships hit a '\' or a '/' it will turn as you would expect a ship to turn (e.g. a '^' that moves into a '/' will turn right). at an intersection, ships will always continue straight through. all ships move at the same speed, ships take turns moving and all ships move during one 'tick'. the one in the most top left goes first, followed by those to its right, then the ones in the next row. it iterates along the rows and then down the columns. each ship moves one space on its turn moving along the route. your function needs to return the position of the first collision between two ships and the number of ticks before the crash occurred.
Answers: 2
question
Computers and Technology, 23.06.2019 04:31
Acloud service provider uses the internet to deliver a computing environment for developing, running, and managing software applications. which cloud service model does the provider offer? a. iaas b. caas c. maas d. paas e. saas
Answers: 1
question
Computers and Technology, 23.06.2019 06:30
You have a small company and want to keep your costs low, but it is important your employees share data. which network would provide you with the most economical solution?
Answers: 1
question
Computers and Technology, 23.06.2019 22:00
Technician a says engine assemblies can be mounted longitudinally in a chassis. technician b says engine assemblies can be mounted transversely in a chassis. who is correct?
Answers: 2
You know the right answer?
1)create a conditional expression that evaluates to string "negative" if userval is less than 0, and...
Questions
question
Mathematics, 09.12.2020 01:00
question
Mathematics, 09.12.2020 01:00
question
Mathematics, 09.12.2020 01:00
Questions on the website: 13722362