Make a c++ program that will print the given output using do while loop.
Output:
5
6
7
8
9
Find the Frequency of Characters. The string entered by the user is stored in variable str. Then, the user is asked to enter the character whose frequency is to be found and display.
Runtime Input :
ksrct r
Output :
1
Make a C++ program that will input a number and display the sum of the numbers from 1 to the input number using do while loop.
The student detail of mark statement of one array to be copied into another array. The order of mark statement of second array should be opposite to those of first array. Write a C program to copy one array into another array using pointers.
Sample Testcase
Input :
5
15
25
35
45
55
Output :
55
45
35
25
15
Each student would have to output the assigned Character using Java or C++ and make it rotate in 360 degrees clockwise
How to execute this using vector
#include <iostream>
bool doesexists(int array[], int toseaarch, int size);
const short int SIZE = 10;
int main() {
int myarray[SIZE], distinct_ctr = 0, index = 0;
std::cout << "Enter 10 numbers: ";
for (index = 0; index < SIZE; index++) {
int tmp;
std::cin >> tmp;
if (!doesexists(myarray, tmp, SIZE)) {
myarray[distinct_ctr] = tmp;
distinct_ctr++;
}
}
std::cout << "distinct numbers are: ";
for (index = 0; index < distinct_ctr; index++)
std::cout << myarray[index] << " ";
std::cout << "\n";
return 0;
}
bool doesexists(int array[], int toseaarch, int size) {
for (int index = 0; index < size; index++) {
if (toseaarch == array[index])
return true;
}
return false;
}
Following is the first four records in a file “data.txt”.
71723 Ram Sen 70 72 75
91924 Raghubir Yadav 82 73 80
53425 Ram Chauhan 93 81 86
44917 Ratan Yadav 95 79 91
Each record contains ID(5 chars), 1 space, First name (10 chars),1 space, Second name (8 chars), 1space, marks in physics( 3chars), 1space, marks in chemistry(3 chars), 1space, marks in mathematics(3 chars) and a newline character.
Write a shell program info.sh to achieve the following
If the program is run without any argument (sh info.sh), it will display the first name, second name and average score of each student in the file.
If the program is run with numeric argument (sh info.sh 44917), it will assume it as ID of student and will output ID, first name, second name and the average score of that student. If ID does not match, the program should display “record not found”.
If the program is run with non-numeric
If the number of arguments is greater than one, the program should display an error message.
Table 1: Driving styles associated with acceleration values
Driving style Economic (1) Normal (2) Aggressive (3)
Acceleration magnitude [m/s2 ] 0.7-2.3 2.31-3.30 3.31-8.5
Create variable ds mapping to store corresponding classification values of 1,2 or 3, which represent different driving style as shown in Table 1. You need to evaluate only the magnitude the of the acceleration/deceleration.
Create a class called Rational for performing arithmetic with fractions. Write a driver program to test your class.
Use integer variables to represent the private data of the class—the numerator and the denominator. Provide a constructor function that enables an object of this class to be initialized when it is declared. The constructor should contain default values in case no initializers are provided and should store the fraction in reduced form
Provide public member functions for each of the
following:
a) Addition of two Rational numbers. The result should be stored in reduced form.
b) Subtraction of two Rational numbers. The result should be stored in reduced form.
c) Multiplication of two Rational numbers. The result should be stored in reduced form.
d) Division of two Rational numbers. The result should be stored in reduced form.
e) Printing Rational numbers in the form a/b where a is the numerator and b is the denominator. in java
Question 20 (10 points)
Write the Java code required to solve the following problem. A complete program is
required and must follow all programming conventions (indenting, variable names,
comments, etc...).
You are to create a program which will place 8 queens on a chess board.
1 - Create a blank chessboard (8 x8 2D array of integers, all O's)
2 - Using a loop, ask the user for 8 locations on the board, replace the O with a 1 at.
this location.
3 - Display the final board.
You do not need to include any error checking or checking for duplicate locations.