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
Bezzdna [24]
3 years ago
11

how to write a function "void funct()" which will accept a string from the user as input and will then display the string backwa

rd.
Computers and Technology
1 answer:
Mariulka [41]3 years ago
5 0

Answer:

#include <bits/stdc++.h>

using namespace std;

void funct(){

   string name;

   cout<<"enter the string: ";

   cin>>name;

   

    reverse(name.begin(), name.end());

    cout<<"The string is : "<<name<<endl;

   

}

int main()

{

   funct();

 

  return 0;

}

Explanation:

create the function funct() with return type void and declare the variable type string and print a message for asking to used enter the string.  

The string enter by user is store in the variable using cin instruction.

after that, we use a inbuilt function reverse() which takes two argument.

firs argument tell the starting point and second index tell the ending point. then, the reverse function reverse the string.

name.begin() it is a function which return the pointer of first character of string.

name.end()  it is a function which return the pointer of last character of the string.

finally, print the reverse string.

for calling the function, we have to create the main function and then call the function.

You might be interested in
Write three tasks students can preform in a digital classroom?
Nadya [2.5K]

Students can perform several tasks in a digital environment. For example, they can watch instructional videos, take notes, and participate in peer discussions.

this is the right answer .just did it

7 0
3 years ago
Read 2 more answers
20<br>Calculate the kinette energy of a body the speed<br>that will be a mass tragm​
jolli1 [7]

Answer:

20

Explanation:

4 0
3 years ago
Which is a good plan for backing up data?
Ymorist [56]
A, use external storage media such as CDs.
4 0
4 years ago
1.11 LAB: Data frames
grigory [225]

To work with data frames in python, the pandas library ls very efficient. Therefore, the following lines of code will <em>load, subset and display the maximum value</em> of each column in the subset :

import pandas as pd

<em>#This</em><em> </em><em>imports</em><em> </em><em>the</em><em> </em><em>pandas</em><em> </em><em>dataframe</em><em> </em><em>and</em><em> </em><em>alias</em><em> </em><em>it</em><em> </em><em>as</em><em> </em><em>pd</em><em> </em>

df_cars = pd.DataFrame('Cars.csv')

<u>Subsetting the firsts UserNum row</u> :

Using the index location method, the first userNum row has a row index of 0.

df_subset = df.iloc[:0, :]

<em>#this</em><em> </em><em>selects</em><em> </em><em>only</em><em> </em><em>the</em><em> </em><em>first</em><em> </em><em>row</em><em> </em><em>and</em><em> </em><em>all</em><em> </em><em>the</em><em> </em><em>columns</em><em> </em>

<em>#first</em><em> </em><em>row</em><em> </em><em>of</em><em> </em><em> </em><em>df_cars</em><em> </em><em>dataframe</em><em> </em><em>has</em><em> </em><em>been</em><em> </em><em>assigned</em><em> </em><em>to</em><em> </em><em>another</em><em> </em><em>dataframe</em><em> </em><em>called</em><em> </em><em>the</em><em> </em><em>df_subset</em>

df_subset.max()

<em>#the</em><em> </em><em>max</em><em> </em><em>function</em><em> </em><em>returns</em><em> </em><em>the</em><em> </em><em>maximum</em><em> </em><em>value</em><em> </em><em>for</em><em> </em><em>each</em><em> </em><em>column</em><em> </em>

<em>Note</em><em> </em><em>:</em><em> </em><em>the</em><em> </em><em>cars.csv</em><em> </em><em>data</em><em> </em><em>wasn't</em><em> </em><em>provided</em><em>,</em><em> </em><em>However</em><em>,</em><em> </em><em>this</em><em> </em><em>is a</em><em> </em><em>run-through</em><em> </em><em>of</em><em> </em><em>how</em><em> </em><em>to</em><em> </em><em>get</em><em> </em><em>the</em><em> </em><em>required</em><em> </em><em>output</em><em>.</em><em> </em>

Learn more :brainly.com/question/16183131?referrer=searchResults

4 0
3 years ago
Questions: 1) Run the C program, attach a screenshot of the output in the answer sheet. 2) Check the address of the array and th
KiRa [710]

Answer:

Output

mumners = 0x7ffc4d2767d0

Method1: Address of array Elements

numbers[0] = 0x7ffc4d2767d0

numbers[1] = 0x7ffc4d2767d4

numbers[2] = 0x7ffc4d2767d8

numbers[3] = 0x7ffc4d2767dc

numbers[4] = 0x7ffc4d2767e0

Method2: Address of array Elements

numbers[0] = 0x7ffc4d2767d0

numbers[1] = 0x7ffc4d2767e4

numbers[2] = 0x7ffc4d2767f8

numbers[3] = 0x7ffc4d27680c

numbers[4] = 0x7ffc4d276820

sizeof(numbers) = 20

2.

mumners = 0x7ffc4d2767d0

Method1: Address of array Elements

numbers[0] = 0x7ffc4d2767d0

Yes both are same since address of the array is the address of its first element

3.

Method1: Address of array Elements

numbers[0] = 0x7ffc4d2767d0

numbers[1] = 0x7ffc4d2767d4

numbers[2] = 0x7ffc4d2767d8

numbers[3] = 0x7ffc4d2767dc

numbers[4] = 0x7ffc4d2767e0

Method2: Address of array Elements

numbers[0] = 0x7ffc4d2767d0

numbers[1] = 0x7ffc4d2767e4

numbers[2] = 0x7ffc4d2767f8

numbers[3] = 0x7ffc4d27680c

numbers[4] = 0x7ffc4d276820

Address printed using Method1 and Method2 are same since name of the array itself a pointer and adding 1 to it gives second element address and 2 to it gives third element and so on similarly applying address operator over the array elements provides the direct address of the element.

4.

printf("Length(numbers) = %lu\n",sizeof(numbers)/sizeof(numbers[0]));

Dividing an size of array by size of individual array elements gives length of an array

Length(numbers) = 5

5.

Yes even if numbers are passed to a function sizeof can be applied since numbers is starting address of an array and to pass an array as argument its address passed.

5 0
3 years ago
Other questions:
  • Why dose this keep popping up will give brainlest for first person answer
    12·1 answer
  • What is computer engineering?
    11·1 answer
  • A is the smallest unit of application data recognized bysystem software.
    12·1 answer
  • A database interrogation is a major benefit of the database management approach, where end users can query (“ask”) the database
    6·1 answer
  • Microsoft is interested in customers' perceptions of Windows 8, its new PC operating system. Since the research goal is rather s
    15·1 answer
  • Agent Hunt is transferring classified files from the CIA mainframe into his flash drive. SSS represents the size of the files on
    12·1 answer
  • How do i put pics on this app ​
    10·1 answer
  • A reflective cross-site scripting attack (like the one in this lab) is a __________ attack in which all input shows output on th
    14·1 answer
  • Can you help me to write a code with functions,arrays,and pointers in c++?
    5·1 answer
  • Which database can be used to find studies related to allied health sciences?
    6·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!