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
trasher [3.6K]
3 years ago
12

C++ Language Use functions to solve all problems in the mentioned assignment

Computers and Technology
1 answer:
alexdok [17]3 years ago
7 0

Answer:

Following are the program to this question:

Q1:

#include <iostream> //including header file

using namespace std;

int main() //defining main method

{

   int m,n,i; //defining integer variable

   cout<<"Enter starting value: "; //print message

   cin>>m; //input m variable value

   cout<<"Enter ending value: ";//print message

   cin>>n;//input n variable value

   for(i=m;i<=n;i++) //defining loop to count even number  

   {

       if(i%2==0) //check even number condition

       {

           cout<<i<<" "; //print value

       }

   }

   return 0;

}

Q2:

#include<iostream> //include header file

using namespace std;

void menu() //define method menu

{

cout<<"Enter 1 for print your name and id: "<<endl; //print message

cout<<"Enter 2 for sum of odd numbers from 1 to 20: "<<endl;//print message

cout<<"Enter 3 for reverse of any number: "<<endl;//print message

cout<<"Enter 4 for exit"<<endl;//print message

}

void findsum() //define method findsum

{

int s=0,i; //defining integer variable

for(i=1;i<=20;i++) //defining loop to count odd number  

{

s=s+i; //add numbers

}

cout<<"Odd number sum from 1 to 20: "<<s; //print value

}

void revers() //defining method revers

{

int n,r,rev=0; //defining integer variable

cout<<"enter any number: "; //print message

cin>>n; //input value

while(n!=0) //define loop to reverse value

{

r=n%10; //store value in r variable

rev=(rev*10)+r; //add reverse value

n=n/10; //divide digit

}

cout<<"The reverse of a given number is: "<<rev; //print reverse value

}

int main() //defining main method

{

int c,rn; //defining integer variable

char n[30]; // defining char variable

menu(); //calling menu method

cout<<"Enter your selected choice: "<<endl; //print message

cin>>c; //input value in char variable

switch(c) //defining switch

{

   //defining case

case 1: cout<<"Enter your name: "<<endl; //print message for input name and id  

       cin>>n;//input name

       cout<<"Enter registration number: "<<endl; //print message  

       cout<<"Name: "<<n<<endl; // print name value

       cout<<"Registration number: "<<rn<<endl; // print id value

   break;

case 2: findsum(); //calling findsum method

   break;

case 3: revers(); //calling reverse method

   break;

case 4: exit(1); // calling exit method

   break;

default: cout<<"please enter valid choice"; //defining default choice

   break;

}

return 0;

}

Q3:

#include <iostream>//defining header file

using namespace std;

void reverse() //defining method readInput

{

  char x; //defining char variable

  cout<<"Enter a character: "; //print message

  cin>>x; //input value

  if(x=='.') //defining condition that check value is .  

   return; //using return keyword

  reverse(); //calling readInput method

  cout<<x; //print value

}

int main() //defining main method

{

  reverse(); //calling readInput method

return 0;    

}

Output:

please find the attachment.

Explanation:

Description of the given question as follows:

  • In question 1, three integer variable "m, n and i" is declared, in which variable "m and n" is used in user input, and variable "i" is used a loop to print even number from the user input values.
  • In question 2, a menu method is declared that prints a list menus in the next line, two methods "findsum() and revers()"is declared, in which "findsum" method is used to add odd values from 1 to 20 and the revers method is used to reverse value from an input digit. In the last line main method is declared, which uses switch to call the above methods.
  • In question 3, in this, a reverse method is defined, in which a char variable x is declared that input char value and define if block to check if char is equal to (.) if this is correct it will print the value in reverse order.

You might be interested in
Which of the following is NOT an option in the comments group
IgorLugansk [536]
I need the options to help you out, thanks. :)
4 0
3 years ago
The field of ____ is concerned with the technical issues involved in information display. computer science
Nataliya [291]

The field of <u>Computer graphics</u> is concerned with the technical issues involved in the information display. The correct option is A.

<h3>What is computer graphics?</h3>

Computer graphics is a branch of computer science called computer graphics research techniques for digitally synthesizing and modifying visual content.

Even while the phrase is frequently used to describe the study of three-dimensional computer graphics, it also includes image processing and two-dimensional graphics. This section works for information display.

Thus, the correct option is A. Computer graphics.

To learn more about computer graphics, refer to the link:

brainly.com/question/1169945

#SPJ4

The question is incomplete. Your most probably complete question is given below:

Computer graphics

computer-aided visualization

computer visualization

engineering graphics

7 0
2 years ago
Which type of communication protocol converts data into standard formats that can be used by applications?
larisa86 [58]
<span>Arrival protocols are the type of data protocols that convert data into standard formats that can be used by applications, such as email, Web browsers and Skype</span>
8 0
3 years ago
How do u friend people
Verdich [7]
You click on the three dots and click the person silhouette with the plus sign on it.
4 0
4 years ago
Read 2 more answers
When creating a user generated function, what procedure is followed?
marin [14]

When creating a user-generated function, what procedure is followed d) all of the above.

<h3>What are the three factors of user-described characteristic?</h3>

A user-described characteristic has 3 essential additives which might be characteristic declarations, characteristic definition and characteristic called.

The characteristic prototypes are used to inform the compiler approximately the variety of arguments and approximately the specified datatypes of a characteristic parameter, it additionally tells approximately the go-back kind of the characteristic. By this information, the compiler cross-assessments the characteristic signatures earlier than calling.

Read more about the prototype :

brainly.com/question/7509258

#SPJ1

6 0
2 years ago
Other questions:
  • What websites can help you learn about general career treads
    11·1 answer
  • Why is it important to have regular maintenance and care of your office equipment?
    5·1 answer
  • 1. Write a bash script to create 3 files of different size greater than 1700 kb and less than 1800 kb . The 2. Content of the fi
    9·1 answer
  • Julie bought a house for $315,000 and has a $285,000 mortgage. she claims she has $315,000 in equity. is she correct? if not, ho
    12·2 answers
  • Which option marks all modification made within a document? Review Comment Track Changes Balloons
    15·2 answers
  • What is the value of the average variable after the following code is executed? var sum = 0; var prices = [14, 10, 9, 12, 11, 14
    14·1 answer
  • Joann wants to insert page numbers at the bottom of the pages of her document using the Field option in Quick
    12·2 answers
  • How to get bing with any node unblocker
    10·2 answers
  • In what medium do web applications operate?
    8·1 answer
  • Operating systems move code and data, as necessary, to a portion of the disk that is used as if it were memory, not just disk st
    9·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!