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
Serga [27]
3 years ago
9

Write an application program in C++ to implement a class Fibonacci to print Fibonacci series upto N using member function series

() .
​

Computers and Technology
1 answer:
fiasKO [112]3 years ago
5 0

Answer:

Program approach:-

  • Using the header file.
  • Using the standard namespace I/O.
  • Define the main function.
  • Display the number of terms.
  • Display the Fibonacci series.
  • Print the first two numbers.

Explanation:

Program:-

//header file

#include <iostream>

//using namespace

using namespace std;

//main function

int main() {

   int n, s1 = 0, s2 = 1, nextTerm = 0;

//display the number of terms

   cout << "Enter the number of terms: ";

   cin >> n;

//display the Fibonacci series

   cout << "Fibonacci Series: ";

   for (int j = 1; j <= n; ++j) {

       // Prints the first two terms.

       if(j == 1) {

           cout << s1 << ", ";

           continue;

       }

       if(j == 2) {

           cout << s2 << ", ";

           continue;

       }

       nextTerm = s1 + s2;

       s1 = s2;

       s2 = nextTerm;

       

       cout << nextTerm << ", ";

   }

You might be interested in
Despite the rise of messaging apps and other forms of social media, these efforts are focused on consumer efforts, with corporat
miss Akunina [59]

Answer:

False

Explanation:

In our current market, we can find some messaging apps and social media designed for corporation organization setting. One example of messaging apps widely used in corporate world is Slack. The Slack enable user to set up different communication channel with their colleagues and flexibly set their working status.

FB also releases a corporate version of social media which is Workplace. The main attracting point is the contents are ad-free and you can expect to see company update or department news from the nesfeed.

4 0
3 years ago
It is important to create an IT security program structure that aligns with program and organizational goals and describes the o
AleksandrR [38]

Answer:

Management and coordination of security-related resources

Explanation:

It is essential to make sure that an information security program is highly secured and non-authorized personnel cannot get access to the program. The security of the program is also important to ensure that valuable information and data of clients are safe. This is one of the most vital in security management.

8 0
3 years ago
1| def saveUserProfile(firstName, lastName, age, height, country):
Feliz [49]

Answer:

Joyner

David

USA

1.8

30

Explanation:

def saveUserProfile(firstName, lastName, age, height, country):

This is the definition of function named saveUserProfile which accepts the following parameters:

  • firstName
  • lastName
  • age
  • height
  • country

filename = lastName + firstName + ".txt"

When the file is created it will be named as the lastName and firstName string combined with .txt as extension. For example if the lastName contains the name string Joyner and firstName contains the name David then the file created to be written is named as JoynerDavid.txt

outputFile = open(filename, "w")

This statement uses open() method in write mode and uses outputFile object to access the file. "w" represents write mode i.e. file is opened in write mode to write on it.

a) Joyner is written on line 1 of that file because of the following statement of above function:

print(lastName, file = outputFile)

This statement prints the string stored in lastName i.e. Joyner. Here outputFile opens the file in "w" write mode and writes the last name to the first line of the file.

b) David is written on line 2 of that file because of the following statement of above function:

print(firstName, file = outputFile)

This statement prints the string stored in firstName i.e. David. Here outputFile opens the file in "w" write mode and writes the first name to the second line of the file.

c) USA is written on line 3 of that file because of the following statement of above function:

print(country, file = outputFile)

This statement prints the data stored in country i.e. USA. Here outputFile opens the file in "w" write mode and writes the country name to the third line of the file.  

d) 1.8 is written on line 4 of that file because of the following statement of above function:

print(height, file = outputFile)

This statement prints the value stored in height i.e. 1.8. Here outputFile opens the file in "w" write mode and writes the height value to the fourth line of the file.  

e) 30 is written on line 5 of that file because of the following statement of above function:

print(age, file = outputFile)

This statement prints the value stored in age parameter of function saveUserProfile i.e. 30. Here outputFile opens the file in "w" write mode and writes the age value to the fifth line of the file.  

7 0
2 years ago
How does climate research depend on digital technology
vodomira [7]
Together We Can Create Digital Systems That Provide Scale, Speed & Enable GrowthCohesive Digital Strategy · Secure IT Infrastructure · Secure Digital Foundation · New Digital EconomyTypes: Digital Business, Digital Operations, Digital Systems, Digital Technology<span>Digital Systems & TechDigital OperationsDigital Business<span>Latest Thinking</span></span>
8 0
3 years ago
Which of these might be an example of an advertisers target group
Eduardwww [97]
Where are the examples?

3 0
3 years ago
Other questions:
  • Consider a file system that uses inodes to represent files. Disk blocks are 2KB in size and a pointer to a disk block requires 4
    13·1 answer
  • You use_____ to view an XPS file
    10·1 answer
  • Select all that apply. Hyperlinks can appear as: words pictures symbols trademarks
    12·2 answers
  • 2. a. Write pseudocode for a divide-and-conquer algorithm for finding valuesof both the largest and smallest elements in an arra
    11·1 answer
  • Casual or informal group meetings are common. Here youcasually chat over tea, meet after work, or get together for purelysocial
    5·1 answer
  • Whats a computer scientist.
    5·2 answers
  • Choose the false statement below. The content that displays in the browser is contained in the head section. The content that di
    14·1 answer
  • java Two smallest numbers Write a program that reads a list of integers, and outputs the two smallest integers in the list, in a
    6·1 answer
  • Every finger has a key it should be resting on when you are not typing<br> 1. False<br> 2. True
    12·2 answers
  • What is an outcome in a game? Don't search google just give me an answer
    9·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!