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
The four general functions of any application program are: data storage, data access logic, application logic and presentation l
miv72 [106K]

Answer:

True is the correct answer to the above question.

Explanation:

  • An application program is used for specific tasks. It is a program with some specified lines of instruction which instruct the computer to process any task.
  • When a user wants to create an application program or project then he can do it with the help of four parts. which are as follows:-
  1. There needs some presentation which can be called as front-end, which is the graphics interface for the user of that program. It facilities the user to drag and drop options for the user of the project.
  2. The second thing is data storage, which is used to store the data of the project.
  3. The third thing is data access logic, which is used to create a logic to extract or add the data to the database.
  4. The fourth thing is application logic which is used to send the data or present the data to the user in front-end design.
  • The above question-statement also wants to states the same which is described above. Hence true is the correct answer to the above question.

5 0
3 years ago
Boole’s theories of logic set the foundation for what aspect of computing today?
AlekseyPX

Answer:

Software aspect of computing

Explanation:

Boole never regarded logic as a branch of mathematics, instead, he proposed that logical propositions should be expressed as algebraic equations. Mathematical operations were replaced with AND, OR.

Boolean algebra provides the basis for analyzing the validity of logical propositions because it captures the two-valued character (binary:  (1 or 0) ) of statements that may be either true or false which is very important for all digital computation of which softwares are part of.

7 0
3 years ago
Ok so I usually don’t do this but I just need an answer , on Instagram a notification popped up while I was watching someone’s s
statuscvo [17]

Answer:

I think it was about cheaper ads on Instagram and how they are lowering their prices.

Explanation:

6 0
3 years ago
Read 2 more answers
cell d1 contains the value 7.877 you want cell d1 to display this value as 7.9 how can you accomplish
Georgia [21]

Answer:

You round?

Explanation:

6 0
4 years ago
Find some search engine as many that you can find
Alexandra [31]
1) google
2) bing
3) yahoo
4) safari
5) baidu
6) ask!
7) aol
8) duckduckgo
9) yandex
10 webcrawler
5 0
3 years ago
Other questions:
  • List several things that geographers can map using remotely sensed data
    5·1 answer
  • What can you search on Microsoft Word or Powerpoint Clipart or Google (Clip art) to find more pictures like the ones below but w
    7·1 answer
  • Why are fixed resistors’ values indicated by color bands rather than printing the numeric value on their exterior?
    13·1 answer
  • Give an example of movies or games that use teleportation
    11·1 answer
  • a_____________ may have its value change during program execution. options. flowchart,counter, Algorithm,None of them​
    15·1 answer
  • What is polymerization1​
    11·1 answer
  • Which similar computer network components connect multiple devices?
    7·1 answer
  • Explain what a datalist element does and is used for.
    12·1 answer
  • What method does a gsm network use to separate data on a channel?
    12·1 answer
  • Write the pseudocode for a program that will process attendance records of CA students. The students attend college five days a
    13·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!