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
Alisiya [41]
3 years ago
10

Create a conditional expression that evaluates to string "negative" if userVal is less than 0, and "non-negative" otherwise. Ex:

If userVal is -9, output is:
-9 is negative. PLEASE USE C++
Computers and Technology
1 answer:
Goryan [66]3 years ago
5 0

Answer:

PROGRAMMING APPROACH:

  • Define the necessary header file using namespace.
  • Define the main() method.
  • Declare variable inside the function().
  • Print result.

Explanation:

Required C++ Code:

#include<iostream>

#include<string>

using namespace std;

int main()

{

  string condStr;

  int userVal;

  cin>>userVal;

  condStr=(userVal<0)?("negative"):("non-negative");

  cout<<userVal<< " is "<< condStr <<"."<<endl;

}

OUTPUT:

-2

-2 is negative.

You might be interested in
Create a macro named mReadInt that reads a 16- or 32-bit signed integer from standard input and returns the value in an argument
timofeeve [1]

Answer:

;Macro mReadInt definition, which take two parameters

;one is the variable to save the number and other is the length

;of the number to read (2 for 16 bit and 4 for 32 bit) .

%macro mReadInt 2

mov eax,%2

cmp eax, "4"

je read2

cmp eax, "2"

je read1

read1:

mReadInt16 %1

cmp eax, "2"

je exitm

read2:

mReadInt32 %1

exitm:

xor eax, eax

%endmacro

;macro to read the 16 bit number, parameter is number variable

%macro mReadInt16 1

mov eax, 3

mov ebx, 2

mov ecx, %1

mov edx, 5

int 80h

%endmacro

;macro to read the 32 bit number, parameter is number variable

%macro mReadInt32 1

mov eax, 3

mov ebx, 2

mov ecx, %1

mov edx, 5

int 80h

%endmacro

;program to test the macro.

;data section, defining the user messages and lenths

section .data

userMsg db 'Please enter the 32 bit number: '

lenUserMsg equ $-userMsg

userMsg1 db 'Please enter the 16 bit number: '

lenUserMsg1 equ $-userMsg1

dispMsg db 'You have entered: '

lenDispMsg equ $-dispMsg

;.bss section to declare variables

section .bss

;num to read 32 bit number and num1 to rad 16-bit number

num resb 5

num1 resb 3

;.text section

section .text

;program start instruction

global _start

_start:

;Displaying the message to enter 32bit number

mov eax, 4

mov ebx, 1

mov ecx, userMsg

mov edx, lenUserMsg

int 80h

;calling the micro to read the number

mReadInt num, 4

;Printing the display message

mov eax, 4

mov ebx, 1

mov ecx, dispMsg

mov edx, lenDispMsg

int 80h

;Printing the 32-bit number

mov eax, 4

mov ebx, 1

mov ecx, num

mov edx, 4

int 80h

;displaying message to enter the 16 bit number

mov eax, 4

mov ebx, 1

mov ecx, userMsg1

mov edx, lenUserMsg1

int 80h

;macro call to read 16 bit number and to assign that number to num1

;mReadInt num1,2

;calling the display mesage function

mov eax, 4

mov ebx, 1

mov ecx, dispMsg

mov edx, lenDispMsg

int 80h

;Displaying the 16-bit number

mov eax, 4

mov ebx, 1

mov ecx, num1

mov edx, 2

int 80h

;exit from the loop

mov eax, 1

mov ebx, 0

int 80h

Explanation:

For an assembly code/language that has the conditions given in the question, the program that tests the macro, passing it operands of various sizes is given below;

;Macro mReadInt definition, which take two parameters

;one is the variable to save the number and other is the length

;of the number to read (2 for 16 bit and 4 for 32 bit) .

%macro mReadInt 2

mov eax,%2

cmp eax, "4"

je read2

cmp eax, "2"

je read1

read1:

mReadInt16 %1

cmp eax, "2"

je exitm

read2:

mReadInt32 %1

exitm:

xor eax, eax

%endmacro

;macro to read the 16 bit number, parameter is number variable

%macro mReadInt16 1

mov eax, 3

mov ebx, 2

mov ecx, %1

mov edx, 5

int 80h

%endmacro

;macro to read the 32 bit number, parameter is number variable

%macro mReadInt32 1

mov eax, 3

mov ebx, 2

mov ecx, %1

mov edx, 5

int 80h

%endmacro

;program to test the macro.

;data section, defining the user messages and lenths

section .data

userMsg db 'Please enter the 32 bit number: '

lenUserMsg equ $-userMsg

userMsg1 db 'Please enter the 16 bit number: '

lenUserMsg1 equ $-userMsg1

dispMsg db 'You have entered: '

lenDispMsg equ $-dispMsg

;.bss section to declare variables

section .bss

;num to read 32 bit number and num1 to rad 16-bit number

num resb 5

num1 resb 3

;.text section

section .text

;program start instruction

global _start

_start:

;Displaying the message to enter 32bit number

mov eax, 4

mov ebx, 1

mov ecx, userMsg

mov edx, lenUserMsg

int 80h

;calling the micro to read the number

mReadInt num, 4

;Printing the display message

mov eax, 4

mov ebx, 1

mov ecx, dispMsg

mov edx, lenDispMsg

int 80h

;Printing the 32-bit number

mov eax, 4

mov ebx, 1

mov ecx, num

mov edx, 4

int 80h

;displaying message to enter the 16 bit number

mov eax, 4

mov ebx, 1

mov ecx, userMsg1

mov edx, lenUserMsg1

int 80h

;macro call to read 16 bit number and to assign that number to num1

;mReadInt num1,2

;calling the display mesage function

mov eax, 4

mov ebx, 1

mov ecx, dispMsg

mov edx, lenDispMsg

int 80h

;Displaying the 16-bit number

mov eax, 4

mov ebx, 1

mov ecx, num1

mov edx, 2

int 80h

;exit from the loop

mov eax, 1

mov ebx, 0

int 80h

7 0
3 years ago
Describe the pace of change in ICT
densk [106]

Answer:

Information and communications technology is an extensional term for information technology that stresses the role of unified communications and the integration of telecommunications and computers, as Technology Trends 2016

#1: Spreading intelligence throughout the cloud. ...

#2: Self-managing devices. ...

#3: Communication beyond sight and sound. ...

#4: Fundamental technologies reshaping what networks can do. ...

#5: Weaving security and privacy into the IoT fabric.

Explanation:

look for a question that i have answered answer it and also plz give me brainliest on this one plz

4 0
3 years ago
Define the role of websites in internet.also write the importance of internet in our daily life.
BabaBlast [244]

Answer:

       

      <u> </u><u>Role of websites in internet</u>

  • Websites give the online way to the business,it helps the business to grow and reach the higher audience. There was a time,at which there is no apps only HTML/CSS websites are there so it is a building step for reaching the audience.
  • Time is a one of the major factors for growth in online sector, and websites provide a interface to use their resources and services at less time ,you don't have to go somewhere now you can order from anywhere and anytime. 24/7 hour services gives a boost to the websites.
  • Some of the Applications are Very big but you can access them in very less amount of internet. Apps never replace websites.
  • Most of the billionaires are the ones who builds there website like amazon, twitter etc. It is very important to have a website for the business        

        <u>Importance of internet in our daily life</u>

  • Internet provides various resources and services which we need at every time like booking a cab,hotel,flight,trains and tutoring services . It consist a vast variety of information which is required at every moment .
  • We really don't need any physical presence of someone to learn something , to understand or for asking it is enough up on internet. Things are changing as technology grows.
  • For leisure time, it provide social sites to enjoy and there are much good options to ask the question of any subject.      
  • It also give option to promote business , it helps to reach to higher audience, many companies give services to us as there business. Digital marketing is also up there to promote on social sites.
3 0
3 years ago
To reduce costs and the environmental impact of commuting, your company decides to close a number of offices and to provide supp
kkurt [141]

Answer:

The description including its query is provided throughout the section of the elaboration elsewhere here.

Explanation:

  • Coordination between teams is the main challenge that this new strategy can make. Agile creation is focused on the teamwork of cross-functional teams, where every other mission is identified and distinct teams are formed. All the departments collaborate and afterward work in stages until the completion of this research project.
  • Unless the organization shuts several departments, contact with various teams and peers will be disrupted and contact differences with workers as well as the team would be established.
  • The best approach will be to provide regular communication calls with multiple project managers such that each project stage is synchronized. In turn, this same project coordinator should always have numerous calls with his group members to even get construction progress.
6 0
2 years ago
Which wireless standard has bandwidth up to 54 Mbps and signals in a regulated frequency spectrum around 5 GHz?
Tamiku [17]

Answer:

802.11a

Explanation:

802.11a supports bandwidth of 54 Mbps in a regulated frequency spectrum of 5 GHz. 802.11a also referred to as Wi-fi 2. 802.11a is basically costs higher than 802.11b though both were created at the same time. Hence 802.11b is more popular than 802.11a . All of them are developed by IEEE.

4 0
3 years ago
Other questions:
  • Assume that
    7·1 answer
  • The actual database of active directory shared resources is stored on one or more computers designated as:
    10·1 answer
  • what notation system supports presenting the largest numbers using fewest digits; Binary, decimal or hexadecimal?
    11·1 answer
  • Write the code for invoking a method named sendObject. There is one argument for this method which is of type Customer. Assume t
    14·1 answer
  • What is an Operating System ??
    7·1 answer
  • 9. Themes can be modified using variants. *<br><br>True<br>False​
    7·2 answers
  • What are the three main components of a for loop?
    9·1 answer
  • Helppppppppppp please
    5·2 answers
  • A company database needs to store information about employees (identified by ssn, with salary and phone as attributes), departme
    7·1 answer
  • A. Why are the data known as raw facts? Explain.​
    14·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!