SlideShare uma empresa Scribd logo
1 de 1
My problem is complete partially written C++ program, the program continuously prompts user
for an integer until user enters 0, the program passes the value to the function that computes the
sum of all the whole numbers from 1 up to and including the entered number. next the program
passes the value to another function that computes the product of all the whole numbers up to
and including the entered number. Here is the code including some of my work #include
#include int number1, number2; void sums(int);//function declaration void
products(int);//function declaration using namespace std; int main() { double number; cout <<
"Enter a positive integer or 0 to quit: "; cin >> number; while(number != 0) { // Call sums
function here sums(number); // Call products function here // products(int); } return 0; } // End of
main function // Write sums function here //void sums(int number1, int number2) //{ //if
number1 //sums = number1 + number2 // Write products function here //products(int number1,
int number2) //Declarations //int total //products = number1 * number2 I am trying to work in
steps however when I try to call the function sums if I put in parans int number1, int number2 or
double number I get errors.
Solution
#include #include #include #include using namespace std; int number; int main() { cout <<
"Enter a positive number" << endl; cin >> number; while (number < 0) { cout << "Enter a
positive number" << endl; } if (number > 0) { cout << "Awesome job!" << endl; } return 0; }

Mais conteúdo relacionado

Semelhante a My problem is complete partially written C++ program- the program cont.docx

C++ Overview
C++ OverviewC++ Overview
C++ Overview
kelleyc3
 
Csc1100 lecture05 ch05
Csc1100 lecture05 ch05Csc1100 lecture05 ch05
Csc1100 lecture05 ch05
IIUM
 

Semelhante a My problem is complete partially written C++ program- the program cont.docx (20)

Programming For As Comp
Programming For As CompProgramming For As Comp
Programming For As Comp
 
Programming For As Comp
Programming For As CompProgramming For As Comp
Programming For As Comp
 
Beginner C++ easy slide and simple definition with questions
Beginner C++ easy slide and simple definition with questions Beginner C++ easy slide and simple definition with questions
Beginner C++ easy slide and simple definition with questions
 
Lec1_EENG112-Introduction.pdf
Lec1_EENG112-Introduction.pdfLec1_EENG112-Introduction.pdf
Lec1_EENG112-Introduction.pdf
 
Chap 5 c++
Chap 5 c++Chap 5 c++
Chap 5 c++
 
Programming basics
Programming basicsProgramming basics
Programming basics
 
C++ Overview
C++ OverviewC++ Overview
C++ Overview
 
OOPS using C++
OOPS using C++OOPS using C++
OOPS using C++
 
Chap 5 c++
Chap 5 c++Chap 5 c++
Chap 5 c++
 
Presentation 2 (1).pdf
Presentation 2 (1).pdfPresentation 2 (1).pdf
Presentation 2 (1).pdf
 
Csc1100 lecture05 ch05
Csc1100 lecture05 ch05Csc1100 lecture05 ch05
Csc1100 lecture05 ch05
 
Lab-11-C-Problems.pptx
Lab-11-C-Problems.pptxLab-11-C-Problems.pptx
Lab-11-C-Problems.pptx
 
C chap02
C chap02C chap02
C chap02
 
C chap02
C chap02C chap02
C chap02
 
Chapter2
Chapter2Chapter2
Chapter2
 
cpp-streams.ppt,C++ is the top choice of many programmers for creating powerf...
cpp-streams.ppt,C++ is the top choice of many programmers for creating powerf...cpp-streams.ppt,C++ is the top choice of many programmers for creating powerf...
cpp-streams.ppt,C++ is the top choice of many programmers for creating powerf...
 
03b loops
03b   loops03b   loops
03b loops
 
C# Loops
C# LoopsC# Loops
C# Loops
 
Basic c programming and explanation PPT1
Basic c programming and explanation PPT1Basic c programming and explanation PPT1
Basic c programming and explanation PPT1
 
C++ project
C++ projectC++ project
C++ project
 

Mais de maximapikvu8

Mais de maximapikvu8 (20)

Wings of birds and wings of insects are---It is a 12 letter word in a.docx
Wings of birds and wings of insects are---It is a 12 letter word in a.docxWings of birds and wings of insects are---It is a 12 letter word in a.docx
Wings of birds and wings of insects are---It is a 12 letter word in a.docx
 
Windows provides a very simple mechanism for sharing files among users.docx
Windows provides a very simple mechanism for sharing files among users.docxWindows provides a very simple mechanism for sharing files among users.docx
Windows provides a very simple mechanism for sharing files among users.docx
 
Why was Pericles an important figure- in the City of Athens- 2- Clearl.docx
Why was Pericles an important figure- in the City of Athens- 2- Clearl.docxWhy was Pericles an important figure- in the City of Athens- 2- Clearl.docx
Why was Pericles an important figure- in the City of Athens- 2- Clearl.docx
 
why is this error showing what have i done wrong Declunilearetant v.docx
why is this error showing what have i done wrong    Declunilearetant v.docxwhy is this error showing what have i done wrong    Declunilearetant v.docx
why is this error showing what have i done wrong Declunilearetant v.docx
 
Why is this error showing NewAge2-java-17- error- cannot find symbol n.docx
Why is this error showing NewAge2-java-17- error- cannot find symbol n.docxWhy is this error showing NewAge2-java-17- error- cannot find symbol n.docx
Why is this error showing NewAge2-java-17- error- cannot find symbol n.docx
 
Why is it important to reduce disulfide linkages prior to SDS electrop.docx
Why is it important to reduce disulfide linkages prior to SDS electrop.docxWhy is it important to reduce disulfide linkages prior to SDS electrop.docx
Why is it important to reduce disulfide linkages prior to SDS electrop.docx
 
Why do statisticians prefer to select samples by a random process- Que.docx
Why do statisticians prefer to select samples by a random process- Que.docxWhy do statisticians prefer to select samples by a random process- Que.docx
Why do statisticians prefer to select samples by a random process- Que.docx
 
Why do employers ask for demographic information- (select all that app.docx
Why do employers ask for demographic information- (select all that app.docxWhy do employers ask for demographic information- (select all that app.docx
Why do employers ask for demographic information- (select all that app.docx
 
Why can bio-prospecting be controversial- Species are frequently drive.docx
Why can bio-prospecting be controversial- Species are frequently drive.docxWhy can bio-prospecting be controversial- Species are frequently drive.docx
Why can bio-prospecting be controversial- Species are frequently drive.docx
 
Why did Malthus's predictions was not realized for most of the develop.docx
Why did Malthus's predictions was not realized for most of the develop.docxWhy did Malthus's predictions was not realized for most of the develop.docx
Why did Malthus's predictions was not realized for most of the develop.docx
 
Why are accessory pigments important- A- They are a rich source of ele.docx
Why are accessory pigments important- A- They are a rich source of ele.docxWhy are accessory pigments important- A- They are a rich source of ele.docx
Why are accessory pigments important- A- They are a rich source of ele.docx
 
Which xml tag defines global parameters available to all servlets in t.docx
Which xml tag defines global parameters available to all servlets in t.docxWhich xml tag defines global parameters available to all servlets in t.docx
Which xml tag defines global parameters available to all servlets in t.docx
 
While using K-means clustering- we scale the variables before we do cl.docx
While using K-means clustering- we scale the variables before we do cl.docxWhile using K-means clustering- we scale the variables before we do cl.docx
While using K-means clustering- we scale the variables before we do cl.docx
 
Which statements about chromosomal organization are true and which are.docx
Which statements about chromosomal organization are true and which are.docxWhich statements about chromosomal organization are true and which are.docx
Which statements about chromosomal organization are true and which are.docx
 
Which statement below best compares the lithosphere to the crust accor.docx
Which statement below best compares the lithosphere to the crust accor.docxWhich statement below best compares the lithosphere to the crust accor.docx
Which statement below best compares the lithosphere to the crust accor.docx
 
Which statement about education as a demographic factor is accurate- M.docx
Which statement about education as a demographic factor is accurate- M.docxWhich statement about education as a demographic factor is accurate- M.docx
Which statement about education as a demographic factor is accurate- M.docx
 
Which pairing of microorganism and bioremediation application is NOT c.docx
Which pairing of microorganism and bioremediation application is NOT c.docxWhich pairing of microorganism and bioremediation application is NOT c.docx
Which pairing of microorganism and bioremediation application is NOT c.docx
 
Which scenario is most likely to maintain trait variation in a populat.docx
Which scenario is most likely to maintain trait variation in a populat.docxWhich scenario is most likely to maintain trait variation in a populat.docx
Which scenario is most likely to maintain trait variation in a populat.docx
 
Which research finding best indicates that a moderator variable was op.docx
Which research finding best indicates that a moderator variable was op.docxWhich research finding best indicates that a moderator variable was op.docx
Which research finding best indicates that a moderator variable was op.docx
 
Which organelles originated from the engulfment of ancestral prokaryti.docx
Which organelles originated from the engulfment of ancestral prokaryti.docxWhich organelles originated from the engulfment of ancestral prokaryti.docx
Which organelles originated from the engulfment of ancestral prokaryti.docx
 

Último

The basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptxThe basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptx
heathfieldcps1
 
Russian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in Delhi
Russian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in DelhiRussian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in Delhi
Russian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in Delhi
kauryashika82
 
The basics of sentences session 3pptx.pptx
The basics of sentences session 3pptx.pptxThe basics of sentences session 3pptx.pptx
The basics of sentences session 3pptx.pptx
heathfieldcps1
 

Último (20)

Key note speaker Neum_Admir Softic_ENG.pdf
Key note speaker Neum_Admir Softic_ENG.pdfKey note speaker Neum_Admir Softic_ENG.pdf
Key note speaker Neum_Admir Softic_ENG.pdf
 
Measures of Dispersion and Variability: Range, QD, AD and SD
Measures of Dispersion and Variability: Range, QD, AD and SDMeasures of Dispersion and Variability: Range, QD, AD and SD
Measures of Dispersion and Variability: Range, QD, AD and SD
 
Sociology 101 Demonstration of Learning Exhibit
Sociology 101 Demonstration of Learning ExhibitSociology 101 Demonstration of Learning Exhibit
Sociology 101 Demonstration of Learning Exhibit
 
Application orientated numerical on hev.ppt
Application orientated numerical on hev.pptApplication orientated numerical on hev.ppt
Application orientated numerical on hev.ppt
 
Ecological Succession. ( ECOSYSTEM, B. Pharmacy, 1st Year, Sem-II, Environmen...
Ecological Succession. ( ECOSYSTEM, B. Pharmacy, 1st Year, Sem-II, Environmen...Ecological Succession. ( ECOSYSTEM, B. Pharmacy, 1st Year, Sem-II, Environmen...
Ecological Succession. ( ECOSYSTEM, B. Pharmacy, 1st Year, Sem-II, Environmen...
 
The basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptxThe basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptx
 
Basic Civil Engineering first year Notes- Chapter 4 Building.pptx
Basic Civil Engineering first year Notes- Chapter 4 Building.pptxBasic Civil Engineering first year Notes- Chapter 4 Building.pptx
Basic Civil Engineering first year Notes- Chapter 4 Building.pptx
 
This PowerPoint helps students to consider the concept of infinity.
This PowerPoint helps students to consider the concept of infinity.This PowerPoint helps students to consider the concept of infinity.
This PowerPoint helps students to consider the concept of infinity.
 
On National Teacher Day, meet the 2024-25 Kenan Fellows
On National Teacher Day, meet the 2024-25 Kenan FellowsOn National Teacher Day, meet the 2024-25 Kenan Fellows
On National Teacher Day, meet the 2024-25 Kenan Fellows
 
Unit-IV; Professional Sales Representative (PSR).pptx
Unit-IV; Professional Sales Representative (PSR).pptxUnit-IV; Professional Sales Representative (PSR).pptx
Unit-IV; Professional Sales Representative (PSR).pptx
 
INDIA QUIZ 2024 RLAC DELHI UNIVERSITY.pptx
INDIA QUIZ 2024 RLAC DELHI UNIVERSITY.pptxINDIA QUIZ 2024 RLAC DELHI UNIVERSITY.pptx
INDIA QUIZ 2024 RLAC DELHI UNIVERSITY.pptx
 
PROCESS RECORDING FORMAT.docx
PROCESS      RECORDING        FORMAT.docxPROCESS      RECORDING        FORMAT.docx
PROCESS RECORDING FORMAT.docx
 
TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...
TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...
TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...
 
Russian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in Delhi
Russian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in DelhiRussian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in Delhi
Russian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in Delhi
 
Role Of Transgenic Animal In Target Validation-1.pptx
Role Of Transgenic Animal In Target Validation-1.pptxRole Of Transgenic Animal In Target Validation-1.pptx
Role Of Transgenic Animal In Target Validation-1.pptx
 
ICT Role in 21st Century Education & its Challenges.pptx
ICT Role in 21st Century Education & its Challenges.pptxICT Role in 21st Century Education & its Challenges.pptx
ICT Role in 21st Century Education & its Challenges.pptx
 
Python Notes for mca i year students osmania university.docx
Python Notes for mca i year students osmania university.docxPython Notes for mca i year students osmania university.docx
Python Notes for mca i year students osmania university.docx
 
psychiatric nursing HISTORY COLLECTION .docx
psychiatric  nursing HISTORY  COLLECTION  .docxpsychiatric  nursing HISTORY  COLLECTION  .docx
psychiatric nursing HISTORY COLLECTION .docx
 
Z Score,T Score, Percential Rank and Box Plot Graph
Z Score,T Score, Percential Rank and Box Plot GraphZ Score,T Score, Percential Rank and Box Plot Graph
Z Score,T Score, Percential Rank and Box Plot Graph
 
The basics of sentences session 3pptx.pptx
The basics of sentences session 3pptx.pptxThe basics of sentences session 3pptx.pptx
The basics of sentences session 3pptx.pptx
 

My problem is complete partially written C++ program- the program cont.docx

  • 1. My problem is complete partially written C++ program, the program continuously prompts user for an integer until user enters 0, the program passes the value to the function that computes the sum of all the whole numbers from 1 up to and including the entered number. next the program passes the value to another function that computes the product of all the whole numbers up to and including the entered number. Here is the code including some of my work #include #include int number1, number2; void sums(int);//function declaration void products(int);//function declaration using namespace std; int main() { double number; cout << "Enter a positive integer or 0 to quit: "; cin >> number; while(number != 0) { // Call sums function here sums(number); // Call products function here // products(int); } return 0; } // End of main function // Write sums function here //void sums(int number1, int number2) //{ //if number1 //sums = number1 + number2 // Write products function here //products(int number1, int number2) //Declarations //int total //products = number1 * number2 I am trying to work in steps however when I try to call the function sums if I put in parans int number1, int number2 or double number I get errors. Solution #include #include #include #include using namespace std; int number; int main() { cout << "Enter a positive number" << endl; cin >> number; while (number < 0) { cout << "Enter a positive number" << endl; } if (number > 0) { cout << "Awesome job!" << endl; } return 0; }