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
lorasvet [3.4K]
3 years ago
14

How do I fix when it hits the second session it skips scanf..

Computers and Technology
1 answer:
kozerog [31]3 years ago
4 0

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!");

}

}

}

You might be interested in
How much power is consumed by a 1.4A motor connected to a 12V battery?​
AleksAgata [21]

Capacity

A battery's capacity determines roughly how long a battery will last at a specific voltage given a specific discharge rate. For example, if you choose a 12V, 2Ah (2000mAh) battery pack (regardless of chemistry), the battery should be able to run a 12V motor consuming 2A continuously for 1 hour. Alternatively, it can run a 12V motor consuming 1A for 2 hours, or a 12V motor consuming 0.5A for 4 hours. The rule of thumb is to divide the capacity (assuming you are running an actuator at the same voltage) by the actuator's current under normal load to get the time the motor will last.

8 0
3 years ago
Using a "word" of 3 bits, list all of the possible signed binary numbers and their decimal equivalents that are representable in
Paul [167]
The sign bit is the high order bit, so that leaves two bits for the value. Two bits can represent 0-3. 2^2 possibilities.
6 0
3 years ago
USDA-APHIS Animal Care Resource Policy #12 "Considerations of Alternatives to Painful/Distressful Procedures" states that when a
katrin2010 [14]

Answer:

C. The specific field of study

C. change in anesthetic agent

Explanation:

In the consideration for the procedure, some information are required and examples are the strategy of the search/the database name. However, the area of study is not one of the information.

The animal use proposal can general be altered based on the type of change required. However, an anesthetic agent alteration is not a significant change.

6 0
3 years ago
Anyone wanna hop on 1v1.lol<br> party code : usfhb6
hjlf

Answer:

thx for the points

Explanation:

8 0
3 years ago
Read 2 more answers
By default, the pfsense firewall allows unrestricted outbound access from the lan interface. true or false?
Sav [38]

The statement "By default, the pfSense firewall allows unrestricted outbound access from the lan interface" is true.

pfSense is free and open source firewall and router that can be installed on a physical computer or a virtual machine. Teh goal is to make the machine a dedicated firewall/router for a network.

 It features unified threat management, load balancing, multi WAN etc.


8 0
4 years ago
Read 2 more answers
Other questions:
  • A species of snake lives in a rainforest. Which would be an adaptation for this
    10·2 answers
  • What is the purpose for adding images and graphics to a web page?
    5·1 answer
  • The _________ check is a type of hardware control that involves adding a "1" or a "0" to the end of every 8 bit byte such that t
    11·1 answer
  • Write a complete program whose class name is hello and that displays hello, world on the screen.
    13·2 answers
  • THE bestValue PROBLEM Using the Camera structure defined in file p1.cpp, write the function named bestValue(). The function take
    13·1 answer
  • What is true about using the reserved word super?
    9·1 answer
  • During the _______ steps of the information processing cycle, data is manipulated, calculated, or organized to create useful inf
    9·1 answer
  • Typically, a DVD has how many times more capacity than a CD?
    12·1 answer
  • Which line of code in this program is MOST likely to result in an error
    15·2 answers
  • One of the earliest computer networks was the ARPANET, developed in the early 1960s. The purpose of this network was to:
    13·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!