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
maksim [4K]
2 years ago
5

Help needed in C++ programming!

Computers and Technology
2 answers:
Mila [183]2 years ago
6 0

Answer:

#include <iostream>

#include<conio.h>

using namespace std;

void main()

{

float freqk, freqsk1, freqsk2, freqsk3;

cout<<"Enter the Frequency of a Key = "

cin>>freqk;

freqsk1 = freqk * (1) * (1/6);

freqsk2 = freqk * (2) * (1/6);

freqsk3 = freqk * (3) * (1/6);

cout<<"\nFrequency of Key = "<<freqk<<endl;

cout<<"\nFrequency of Subsequent Key 1 = "<<freqsk1<<endl;

cout<<"\nFrequency of Subsequent Key 2 = "<<freqsk2<<endl;

cout<<"\nFrequency of Subsequent Key 3 = "<<freqsk3<<endl;

getch();

}

Explanation:

There are four variables required to store the frequency value of a key and its subsequent keys. All variable are in float values so that answer should calculated in decimal format. With the help of formula calculate the frequency of all subsequent keys with the help of given frequency of key.

Komok [63]2 years ago
6 0

Answer:

This program is executed in C++ using dev C++, The explanation of the code is given below. However, the expected result of this program after running is attached

Explanation:

#include <iostream>

#include <cmath>

#include<bits/stdc++.h>

using namespace std;

int main ()

{

double key=5;//it will generate next three keys from A;

double freq=440;//frequency ;

cout<<freq<<"     ";//output the frequency

for(double i=2;i<key;i++)//loop to show next three frequency

{

float value = (1.0/12);// store value of (1/12)

double r=pow(2.0,value);//store value of r=2^(1/12);

 

double n=i;//number of ith iteration (number of next key)

double power=pow(r,n);//calculating r^n;

 

double result= freq* power;//function i.e. fn=f0*rn

cout<<result<<"     ";//displaying result

}

 

 

}

You might be interested in
Which of the following definition below describes a wall opening?
My name is Ann [436]
A. An opening at least 30 inches high and 18 inches wide in any wall or partition. 
5 0
3 years ago
Read 2 more answers
Copy the skeleton of code below into your answer. Then in the space indicated, add your own code to prompt the user for two numb
ahrayia [7]

Answer:

import java.util.*;

public class Main

{

public static void main(String[] args) {

    Scanner input = new Scanner(System.in);

   

 System.out.print("Enter the first: ");

 int first = input.nextInt();

 System.out.print("Enter the second: ");

 int second = input.nextInt();

 input.nextLine();

 System.out.print("Enter your name: ");

 String name = input.nextLine();

 

 int difference = Math.abs(second - first);

 

 System.out.println(name + ", the difference is " + difference);

}

}

Explanation:

*The code is in Java.

Create a Scanner object to get input from the user

Ask the user to enter the first, second, and name

Calculate the difference, subtract the second from the first and then get the absolute value of the result by using Math.abs() method

Print the name and the difference as in required format

7 0
2 years ago
Which is better? iPhone 11 Pro Max or Samsung Galaxy Note 20 Ultra 5G and why?
Allisa [31]

Answer:

Samsung note 20 or iPhone but i think Samsung

Explanation:

8 0
3 years ago
Read 2 more answers
13. You're doing research for a paper. When would you use an indirect citation?
Whitepunk [10]

Answer:

D

Explanation:

d is the answer

5 0
2 years ago
This program is to compute and write to a file the GPA for student scores read from an input file. The point values of the grade
VARVARA [1.3K]

Answer:

#Take input from the user

filename=input('Enter name of input file: ')

total_units=0#Total number of units for a student

total_score=0#Total score of a student

#Assign a score to each grade. I have reduced 0.33 for each grade. Change here if you need to

grade={'A':4.0,'A-':3.67,'B+':3.34,'B':3.01,'B-':2.68,'C+':2.35,'C':2.02,'C-':1.69,'D+':1.36,'D':1.03}

try:

with open(filename,"r") as input_file:#Open the file for input(reading)

output_file=open("GPA_output.txt","w") #Create and open GPA_output.txt if it doesn't exist for writing

for student_record in input_file:#read from input file

if("," in student_record):#if there is a , that means this is the student name

student_name=student_record.strip('\n')#Remove \n from student name

continue

else:

if(" " in student_record):#If a line contains spaces then its the student's grades for a course

student=student_record.split(" ")#Split to find the coursename, units and grade

#student[0]=coursename student[1]=units student[2]=grade

total_units+=int(student[1])#Calculate total units for 1 student

total_score+=int(student[1])*grade[student[2].strip('\n')]#Find the total score of a student

#grade[student[2]] will lookup for the score that we initialized earlier

#if student has a grade as A then this will look up as grade['A'] which will return 4

#Find the total score as product of this grade and units for this course

continue

else:

if(total_units>0):#Check if score has been calculated for a student earlier

print("in")

GPA=total_score/total_units#Calculate the GPA

output_file.write("%-26s%.2f\n" % (student_name, GPA))#Write the GPA and Student Name in the required format

total_units=0#reset the units

total_score=0#reset the score

if(total_units>0):#Essential for the case when the file doesn't end with a new line(Check if total_units is not 0) which means a record is pending

#to be written to the file

GPA=total_score/total_units#Calculate the GPA

output_file.write("%-26s%.2f\n" % (student_name, GPA))#Write the GPA and Student Name in the required format

total_units=0#reset the units

total_score=0#reset the score

input_file.close()#Close the input file

output_file.close()#Close the output file

except IOError as e:

print("Problem in Opening the required file")#Print a message if file cannot be opened

Explanation:

The program has been tested for all 3 scenarios mentioned i.e.

a. If the file ends without \n

b. If the file ends with 2 \n

c. If the file ends with 1 \n

PS: The Program will run irrespective of how it ends. Even if there are many \n at the end of file, the program will be fine.

3 0
3 years ago
Other questions:
  • The physical address assigned each network adapter is called its ________.
    6·1 answer
  • Rint "Censored" if userInput contains the word "darn", else print userInput. End with newline.
    11·1 answer
  • str1=”Good” str2=”Evening” Does the concatenation of the above two strings give back a new string or does it concatenate on the
    14·1 answer
  • What are the best data structures to create the following items? And why?
    13·1 answer
  • Is 5g harmful to the body ?
    9·2 answers
  • Why is it important to protect people's intellectual property online?
    10·1 answer
  • What do people do when they navigate using GPS
    6·2 answers
  • How do you give brianliest
    13·1 answer
  • Which is an example of an operating system? (5 points)
    5·1 answer
  • what is the term for software that is exclusively controlled by a company, and cannot be used or modified without permission?
    6·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!