how do I fix when it hits the second session it skips scanf..
#include <stdio.h>
#include <unistd.h>
#include <ctype.h>
main() {
double first, second;
while(1){
printf(" Calculator\n");
printf("\n 7 8 9 / \n 4 5 6 x \n 1 2 3 - \nEnter operator: ");
char op;
scanf("%c" ,&op); //entering operators such as + - \ *
printf("Enter two operands:");
scanf("%lf %lf", &first, &second); //entering operands such as 1 2 5 8 12 414
switch (op) { // printing the math
case '+'://if its +
printf("%.1lf + %.1lf = %lf\n\n", first, second, first + second);
break;
case '-'://if its -
printf("%.1lf - %.1lf = %lf\n\n", first, second, first - second);
break;
case '*'://if its *
printf("%.1lf * %.1lf = %lf\n\n", first, second, first * second);
break;
case '/'://if its :
printf("%.1lf / %.1lf = %lf\n\n", first, second, first / second);
break;
default://if its not + - / *
printf("error!");
}
}
}​

Answers

Answer 1

Answer:

the answer can be found HERE:

https://stackoverflow.com/a/13473767

put a leading space in the scanf(" %c", &op)

Explanation:

#include <stdio.h>

#include <unistd.h>

#include <ctype.h>

main() {

double first, second;

char op;

while(1){

printf(" Calculator\n");

printf("\n 7 8 9 / \n 4 5 6 x \n 1 2 3 - \nEnter operator: ");

scanf(" %c", &op); //entering operators such as + - \ *

printf("Enter two operands:");

scanf("%lf %lf", &first, &second); //entering operands such as 1 2 5 8 12 414

switch (op) { // printing the math

case '+'://if its +

   printf("%.1lf + %.1lf = %lf\n\n", first, second, first + second);

   break;

case '-'://if its -

   printf("%.1lf - %.1lf = %lf\n\n", first, second, first - second);

   break;

case '*'://if its *

   printf("%.1lf * %.1lf = %lf\n\n", first, second, first * second);

   break;

case '/'://if its :

   printf("%.1lf / %.1lf = %lf\n\n", first, second, first / second);

   break;

default://if its not + - / *

   printf("error!");

}

}

}


Related Questions

One of the great advantages of ____ references is that you can quickly generate row and column totals without having to worry about revising the formulas as you copy them to new locations.

Answers

Answer:

relative

Explanation:

What are data bars computer

Answers

Answer:

A data bar is a type of conditional formatting that creates a visual effect in the cells of your database that correspond to the contents of the cell. A cell with a longer bar represents a larger value, while a cell with a shorter bar represents a smaller value

_ ports are audiovisual ports typically used to connect large monitors. These ports are used with many Apple Macintosh computers.

Answers

Thunderbolt ports are audiovisual ports typically used to connect large monitors.

What is a Thunderbolt port?

A Thunderbolt is known to be used in systems by users. It is one that helps its users to be able to use one cable to have an access to a high-speed and high-resolution media.

This is often done by using one port along with a cable that is able to access both DisplayPort and PCI Express. Thunderbolt is known to contain technology that has been built into it that helps PCI Express speed to come in a good and better way.

Learn more about ports  from

https://brainly.com/question/10097616

You are configuring NIC Teaming on a Windows Server system using two physical network adapters. You want to aggregate the bandwidth of both network adapters to provide better throughput. Both adapters are connected to the same network switch. You decide to manually identify the links forming the team on both the switch and the server. What option under Additional properties in the NIC teaming window would you select?

Answers

Answer:

Static Teaming

Explanation:

What does it mean when the lottery machine says function suppressed after scanning a ticket

Answers

When a machine  says function suppressed after scanning a ticket, it implies that you have won some certain amount.

What is lottery  wins?

This term connote that a person has  a winning ticket in a lottery that is often owned by a government.

Note that  if a winning ticket is scanned, the terminal often shows a message just for you and that suppress function implies  that your the ticket has won something.

Learn more about lottery  from

https://brainly.com/question/9216200

Screen reading for extended periods can cause___________ _____________, so the position the monitor to minimize glare and give your eyes a short break every half hour.

Answers

Screen reading for extended periods can cause a syndrome known as the computer vision syndrome

Computer vision Syndrome

What is computer vision Syndrome?

the computer syndrome is characterised by eye discomfort and fatigue, dry eye, blurry vision, and headaches, glare, etc. Uncorrected vision problems are a major cause. it is recommended to stay off the computer for at least thirty minutes to minimise the effects

Learn more about Computer vision Syndrome here:

https://brainly.com/question/8114244

What is a federal budget

Answers

6.6 trillion, the federal The United States federal budget comprises the spending and revenues of the U.S. federal government. The budget is the financial representation of the priorities of the government, reflecting historical debates and competing economic philosophies

How to send large video files without losing quality

Answers

Answer:

Explanation:

The videos can be compressed, easily, with a free program called HandBrake

you can get handbrake here: https://handbrake.fr/

Once you compress them using this program, then you can send them through any messaging service as long as the service takes the file under whatever file size rules it has.


Googul Drive works to send the compressed video well.

how does salmon brown’s account compare to frederick douglass’s account? to what extent do they agree or disagree?

Answers

The  approaches of John Brown and Frederick Douglass had some similarities and differences. When compared,  the men were said to have fought for its eradication but were said to have used different drastic process.

They agree in terms of what they stood for but differs in terms of the approach used.

What is the role of the two men above?

Note that Douglass as a writer, orator, and statesman was said to have been focused on changing some of the policy.

While Brown on the other had is known to be  radical in nature , who was known to stand for violence. With the use of a small army, he was said to have pioneered some multiple rebellions and aided a lot of people escape bondage.

Learn more about bondage from

https://brainly.com/question/24513713

Write an assembly program to find the largest item in an array and store it in a variable named MAXIMUM. Hint: Use both Jump and loop instructions to write the program. Logic: Assume that the first item of the array is the minimum and store it in variable MAXIMUM Write a loop. Inside the loop, compare the each array item with the minimum If the array item is less than the MAXIMUM, update MAXIMUM with that array item. . Data Array WORD 10, 2, 23, 45, 21, 11 MAXIMUM WORD

Answers

Use the knowledge of computational language in C++ to write the a code assembly program to find the largest item.

How to write a maximum function in C++?

To make it simpler the code is described as:

#include<bitd/stdc++.h>

Using namespace std;

Int main(){

Int arr[10]={10, 2, 23, 45, 21, 11};

Int min=INT_MAX;

Int max=INT_MIN;

for(int i=0;i<10;i++)

If(min<arr[i])min=arr[i];

for(int j=0;j<10;j++)

if(max>arr[j])max=arr[j];

Cout<<max<<” “<<min<<endl;

return 0;

See more about C++ code at brainly.com/question/19705654

draw a flow chart to find the sum of two numbers

Answers

The answer is in the above attachment....

HURRY IT'S URGENT
How would you create a variable named myDog and give it the value "Karel"?

options:

var myDog = "Karel":


var myDog = Karel


var myDog = "Karel";


var my Dog = "Karel"

What JavaScript function do we use to print out a message to the user?

options:

printLn()


print()


print


println();

Answers

The variable myDog and the value "Karel" are illustrations of assigning values to variable

The statement that creates the variable is (c). var myDog = "Karel";The function to print in JavaScript is (b) print()

How to create the variable?

To create a variable in JavaScript, you have to add the keyword "var".

Given that the variable name is myDog; So, we have:

var myDog

The value of the variable is "Karel".

Hence, the assignment statement is: C. var myDog = "Karel";

Function to print in JavaScript

To print in JavaScript, we make use of the print() statement

Hence, the function to print in JavaScript is (b) print()

Read more about JavaScript at:

https://brainly.com/question/16698901

What is a search engine ​

Answers

Answer:

A search engine is a software program that helps people find the information they are looking for online using keywords or phrases.

Explanation:

Search engines are able to return results quickly—even with millions of websites online—by scanning the Internet continuously and indexing every page they find.

A new cybersecurity analyst is working at their first job. the analyst requires a penetration test reporting and evidence gathering framework that can run automated tests through integration with metasploit. recommend a framework that will fulfill the analyst's needs.

Answers

The Recommendations of a framework that will help to fulfill the analyst's needs is that he or she should not use Sn1per.

What is Sn1per?

The term Sn1per is known to be a form of automated scanner that is able to be employed in a penetration test.

It is often used to list out and scan for any form of  vulnerabilities. The use of Sn1per will  fulfill the analyst's needs in terms of that framework.

Learn more about test reporting from

https://brainly.com/question/6076728

In this problem. we consider the delay introduced by the tcp slow-start phase. consider a client and a web server directly connected by one link of rate r. suppose the client wants to retrieve an object whose size is exactly equal to 15 s, where s is the maximum segment size (mss). denote the round-trip time between client and server as rtt (assumed to be constant). ignoring protocol headers. determine the time to retrieve the object (including tcp connection establishment) when
a. 4 sir> sir + rtt > 2sir
b. sir + rtt> 4 sir
c. sir> rtt.

Answers

The time that is required to retrieve the object (including TCP connection establishment) when [tex]4S/R > S/R > RTT > 2S/R[/tex] is equal to [tex]\frac{14S}{R}+4RTT[/tex]

How to calculate the time needed to receive all objects.

In this scenario, we would denote the round-trip time that exist between the web server and the client with [tex]RTT[/tex] and assume that it is constant.

The time that is required to retrieve the object when [tex]4S/R > S/R > RTT > 2S/R[/tex] would be calculated by adding the round trip of sender and reciever together as follows:

Round trip = RTT + RTT

Next, we would determine the delay in packet transmission:

Note: [tex]\frac{8S}{R}+\frac{4S}{R}=\frac{12S}{R}[/tex]

[tex]Time = (\frac{S}{R} +RTT)+(\frac{S}{R} +RTT)+(\frac{12S}{R}) +RTT+RTT\\\\Time = \frac{14S}{R}+4RTT[/tex]

When [tex]S/R +RTT > 4S/R[/tex], we have:

The time that is required to retrieve the object would be calculated by adding the round trip of sender and reciever together as follows:

[tex]Time = (\frac{S}{R} +RTT)+(\frac{S}{R} +RTT)+(\frac{8S}{R}) +RTT+RTT\\\\Time = \frac{11S}{R}+5RTT[/tex]

The time that is required to retrieve the object when [tex]S/R > RTT[/tex] would be calculated by adding the round trip of sender and reciever together as follows:

[tex]Time = (\frac{S}{R} +RTT)+(\frac{14S}{R}) +RTT\\\\Time = \frac{15S}{R}+3RTT[/tex]

Read more on round trip here: https://brainly.com/question/6884622

Write a sub program to find the factors of a supplied number

Answers

Answer:

There are two options I can think of for you,

(Qbasic Code)

To Find the Factors of Given Number:

CLS

INPUT "Enter any number"; n

FOR i = 1 TO n

   x = n MOD i

   IF x = 0 THEN

       PRINT i;

   END IF

NEXT i

END

To Find the Factors of Given Number Using COMMON SHARED:

DECLARE SUB factor ()

COMMON SHARED n

CLS

CALL factor

END

SUB factor

INPUT "Enter any number"; n

FOR i = 1 TO n

   x = n MOD i

   IF x = 0 THEN

       PRINT i;

   END IF

NEXT i

END SUB

A citizen of any group has both _____ and _____.

Answers

Answer:

rights and responsibilities

Explanation:

Answer: Down below

Explanation:

Choosing what data to store and where and how to store the data are two key challenges associated with big data. true or false

Answers

Answer:True

Explanation:

what are the two methods of creating a folder​

Answers

Answer:

1. right click empty space, go to New, and click New Folder

2. press Ctrl + Shift + N

Explanation:

A router is connected to a network 192.169.1.0/24 and network 192.168.2.0/24. The router is configured to use RIP and has learned of networks 192.168.3.0/24 and 192.168.4.0/24. The router is also configured with a static route of 0.0.0.0 with a mask of 0.0.0.0. The router receives a packet addressed to the network 10.1.0.0/16. What will the router do with the packet.

Answers

Answer:

Forward the packet to the next hop router specified by the route network 0.0.0.0

Explanation:

Michael bought a game he will play on his computer. The scenes in the game move smoothly, but they seem a little blurry. Which two devices--either or both-might be causing the issue?

keyboard

hard

disk

monitor

mouse

graphics card


Answers

The devices that may be causing the game to appear blurry are the graphics card and the monitor.

What is a graphics card?

The graphics card is a hardware device used in computers to improve their performance when playing videos, video games or other programs that have high graphic demand.

What is a monitor?

Monitor refers to the computer screen. This can have very varied characteristics such as size, range of colors, pixels, among others that can affect the image.

According to the above, either of these two devices can alter the image of the video game, making it look much more blurred.

Learn more about computers in: https://brainly.com/question/21080395

What are 4 componenetas llk computers have in common

Answers

Answer:

Input, storage, processing, and output.

Explanation:

hope this helps you

Terrel is designing and maintaining a web page for a local company. In which career pathways would Terrel be involved?

Programming and Software Development, and Network Systems
Network Systems and Interactive Media
Information Support and Services, and Programming and Software Development
Interactive Media, and Information Support and Services

Answers

Answer:

C information Support and services

Explanation:

Answer:

c

Explanation:

send link for a qc or paddle

Answers

Answer:

heres a few paddles, i dunno which one you want so i put a few.

Explanation:

The software that requests mail delivery from the mail server to an Internet device is known as mail ____ software.

Answers

The software that requests mail delivery from the mail server to an Internet device is known as mail client software.

Explanation:

Mail client software is a form of communication in which electronic messages are created and transferred between two or multiple devices connected to a network series or stream.

What does Amara hope will
happen when Dad sits on the sofa?

Answers

Amara hope her  Dad will be comfortable using the sofa. Check more about sofa below.

What does sofa implies?

A sofa is known to be a type of long seat that is often made with arms and it also has a back rest. One can convert the sofa to a bed.

Conclusively, when Amara got the sofa for her dad, she hope that her dad will be comfortable using the sofa.

Learn more about sofa from

https://brainly.com/question/14791147

qbasic program to convert Nepali rupees into paisa​

Answers

Answer:

INPUT "What is the amount of rupees you want converted into paisa"; rupees

paisa = rupees*100

PRINT paisa

Explanation:

done in QBASIC
the semicolon in the 1st line makes the question have a ? at the end. the rupees key word in the 1st line saves the input as a variable

then the second line multiplies by 100 since there are 100 paisa in 1 rupee

Choose the correct answer in each number.

4. An axe is an example of a _____?
A. pulley B. inclined plane C. wheel and axle D. fulcrum

5. A seesaw is an example of a _____?
A. wedge B. lever C. inclined plane D. pulley

6. A device that has two or more machines working together
A. fulcrum B. pulley C. complexmachine D. motor

7. Stairs"
A. wedge B. pulley C. inclined plane D. wheel and axle

8. Bulb"
A. wedge B. pulley C. inclined plane D. screw

11. Hammer"
A. wedge B. lever C. inclined plane D. wheel and axle

12. What type of simple machine is this?(doorknob)
A. wheel and axle B. gear C. lever D . inclined plane

13. The fixed point on the lever is called _____.
A. load B. resistance C. bar D. fulcrum​

Answers

Hello There!!

An axe is an example of a _____?

A. pulley B. inclined plane C. wheel and axle D. fulcrum

Answer:- B- Inclined Plane

A seesaw is an example of a _____?

A. wedge B. lever C. inclined plane D. pulley

Answer:- B- Lever

A device that has two or more machines working together

A. fulcrum B. pulley C. complex machine D. motor

Answer:- C- Complex Machine

Stairs"

A. wedge B. pulley C. inclined plane D. wheel and axle

Answer:- C. inclined plane

Bulb"

A. wedge B. pulley C. inclined plane D. screw

Answer:- D. Screw

Hammer"

A. wedge B. lever C. inclined plane D. wheel and axle

Answer:- B. Lever

What type of simple machine is this?(doorknob)

A. wheel and axle B. gear C. lever D . inclined plane

Answer:- A. wheel and axle

The fixed point on the lever is called _____.

A. load B. resistance C. bar D. fulcrum

Answer:- D. Fulcrum

Hope This Helps

04. Suppose a computer program needs to sort a list of student records in ascending order
according to last name. The program language determines sort order by using the
individual ASCII number representations of the characters in each name.
If the initial list contains the following names. Which of the following lists represents
the name order after executing the sorting procedure?
["Tom Smith","Joe Schnook", "Kathy Bones","Jill Brewer"]
(A) ["Smith Tom", "Schnook Joe","Bones Kathy","Brewer Jill"]
(B) ["Joe Schnook","Tom Smith","Jill Brewer", "Kathy Bones"]
(C) ["Jill Brewer","Joe Schnook", "Kathy Bones", "Tom Smith")
(D) ["Kathy Bones","Jill Brewer","Joe Schnook","Tom Smith"]

Answers

Answer:

D) ["Kathy Bones", "Jill Brewer", "Joe Schnook", "Tom Smith"]

Explanation:

The context of the problem explains a computer program that sorts names in "ascending order" (A to Z) since the ASCII table has capital A start a lower number and it increases from there to capital Z.

Notice how the attached file, which is a portion of the ASCII table, shows that letters after A are also higher in decimal value than the previous letter.

With this in mind, we know that all this program does is sort by last name alphabetical order. From there, just sort the given names using that same criteria, last name alphabetical order, and the correct answer is determined.

Please put "Brainliest" on my answer if it helped you out!

If you want to learn more about this subject, you can search:

- ASCII Table

- Lists in Programming

- Sorting Procedures

The correct list that represents the name order after executing the sorting procedure is (D) ["Kathy Bones", "Jill Brewer", "Joe Schnook"," Tom Smith"]. Therefore, option D is correct.

What is a computer program?

A computer program is a set of instructions that tells a computer what to do to perform a specific task or solve a problem.

Since the program sorts the names in ascending order according to last name, it will consider the last name first and then sort the names alphabetically based on the ASCII value of the characters in each last name.

So, in the initial list, "Bones" comes before "Brewer", which comes before "Schnook", which comes before "Smith". Therefore, after sorting, the correct order of the names would be: "Kathy Bones", "Jill Brewer", "Joe Schnook", and "Tom Smith". Thus, option D is correct.

Learn more about computer programs, here:

https://brainly.com/question/3397678

#SPJ2

What should you do first to best use your personal goals as a means for a promotion?
O research how your company offers promotions
O show professional behavior at all times
O set both short and long-term personal goals
O make sure some goals are only for personal growth

Answers

Answer:

C. Set both short and long-term personal goals.

Explanation:

This would be the most professional option.

Other Questions
If my dot plot is not skewed or symmetrical which measure of variability should I use? (15 data points) PLEASE HELP THE ASSIGNMENT IS DUE TONIGHT! these are the data points: 5,6,7,7,7,8,8,9,9,9,9,9,10,10,11I also need the best measure of center! Why might a company decide against using hydroelectric energy as an alternative energy resource? What is the approximate volume of a cone with a height of 9 ft and radius of 3 ft? Use 3.14 to approximate pi, and express your final answer to the nearest hundredth Enter your answer as a decimal in the box. ft3 Ayo i need help fast! Why was the renaissance more important than the scientific revolution PLS HELP Lacey has a roll of wrapping paper with 2 3/4 yards remaining. She has six boxes to wrap, each of which requires 3/8 of a yard of paper. Will Lacey have enough wrapping paper left to also wrap a book that requires 1/2 yard of paper? Support your answer by showing your work. 3/9 and 1/2 common denominator If the president wants Congress to pass a law, what does he have to do? What time would it be if the minute hand rotated by 180 degrees from the current time?2:304:003:302:15 Allison, age 40, earns $95,000 annually; her wage replacement ratio has been determined to be 70%. She expects inflation will average 3% over her entire life expectancy. She expects to work until 67, and live until 95. She anticipates a 7. 5% return on her investments. Allison does not expect to receive any Social Security retirement benefits. Calculate Allisons annual retirement needs in todays dollarsWhat is the amount of Allisons first retirement distribution at age 67Calculate Allisons capital needed at retirement age 67 Question 2 of 5Which choice describes the shape of the data?83 84 85 86 87 88 89 90 91 92A. Symmetric; not bell-shaped oB. Not symmetric; not bell-shapedC. Symmetric, bell-shapedoD. Not symmetric, bell-shaped A person on a moving sidewalk travels 6 feet in 3 seconds. The moving sidewalk has a length of 80 feet. How long will it take to move from one end to the other? Andrea is an accountant who lives in the state of Texas. Which tax is she not responsible to pay?. helppppppppp meee too simplify this what is 3.1 converted into a simplified fraction? the autonomic nervous system controlsA. tying your shoesB. Heart Rate C. chewing a bite of foodD. using a fork How often does reapportionment and redistricting of seats occur in the House of Representatives?1.every 2 years2.every 4 years3.every 5 years4.every 8 years5.every 10 years the annual income of Sam is $37,368 . what is his monthly income if he earns an equal amount every month please help me solve for m I have to turn a bunch of these questions tomorrow so pleade help