SlideShare a Scribd company logo
1 of 2
Download to read offline
Please look at the problems I amhavingwhichare listed below:
Write a programthat inputs 10 integers fromthe user into anarray, and removes the duplicate arrayelements. Byremoving, I meant that you
should make it appear as ifthe elements hadn't beenthere. So not just settingduplicates to an"empty"value, but fillinginthe gap. That means
movingallthe later elements back one (kind oflike whenyouhit backspace inthe middle ofa line ina text editor). Or alternatively, storingonlythe
non-repeatingelements. Youmayassume that allthe integers are between0 and 100, Write at least 1 functioninadditionto the mainfunction, and
pass anarrayinto that functionas a parameter.
Output should look exactlylike below. Two rows.
ProgramInput:
0 1 2 3 4 5 6 7 8 9
ProgramOutput:
Please enter 10 integers, hittingreturnafter eachone:n
0 1 2 3 4 5 6 7 8 9
ProgramInput:
100 100 100 100 100 100 100 100 100 100 100
ProgramOutput:
Please enter 10 integers, hittingreturnafter eachone:n
100
ProgramInput:
11 11 22 22 33 33 44 44 55 55
ProgramOutput:
Please enter 10 integers, hittingreturnafter eachone:n
11 22 33 44 55
ProgramInput:
12 37 12 37 45 88 101 21 21 101
ProgramOutput:
Please enter 10 integers, hittingreturnafter eachone:n
12 37 45 88 101 21
I have:
#include<iostream>
usingnamespace std;
void eliminate(int a[], int&siz)
{
int i,n=0;
boolb[101]={false};
for(i=0;i<siz;i++)
b[a[i]]=true;
for(i=0;i<101;i++)
if(b[i]) a[n++]=i;
siz=n;
}
int main()
{
int nums[10];
int i,n=10;
cout<<"Please enter 10 integers, hittingreturnafter eachone:n";
for(i=0;i<n;i++)
cin>>nums[i];
eliminate(nums,n);
cout<<endl;
for(i=0;i<n;i++)
cout<<nums[i]<<"";
return0;
}
--- PROBLEMS I AM HAVING---
1) After, cout<<"Please enter 10 integers, hittingreturnafter eachone:n"; I receive 2 "/n"howdo I onlyreceive one "n"after the colon.
2) For mylast output, I receive 12 12 21 37 45 88 whenI should be receiving12 37 45 88 101 21

More Related Content

What's hot

Chapter 2 - Structure of C++ Program
Chapter 2 - Structure of C++ ProgramChapter 2 - Structure of C++ Program
Chapter 2 - Structure of C++ Program
Deepak Singh
 

What's hot (20)

Comp 122 lab 6 lab report and source code
Comp 122 lab 6 lab report and source codeComp 122 lab 6 lab report and source code
Comp 122 lab 6 lab report and source code
 
Matlab syntax
Matlab syntaxMatlab syntax
Matlab syntax
 
A simple program C# program
A simple program C# programA simple program C# program
A simple program C# program
 
escape sequences and substitution markers
escape sequences and substitution markersescape sequences and substitution markers
escape sequences and substitution markers
 
Flowcharting
FlowchartingFlowcharting
Flowcharting
 
The 4 Step Excel 2013 Functions Guide
The 4 Step Excel 2013 Functions GuideThe 4 Step Excel 2013 Functions Guide
The 4 Step Excel 2013 Functions Guide
 
Basic of c programming www.eakanchha.com
Basic of c programming www.eakanchha.comBasic of c programming www.eakanchha.com
Basic of c programming www.eakanchha.com
 
Chapter 5 Basic operators in programming
Chapter 5   Basic operators in programmingChapter 5   Basic operators in programming
Chapter 5 Basic operators in programming
 
Functions in c++
Functions in c++Functions in c++
Functions in c++
 
How c program execute in c program
How c program execute in c program How c program execute in c program
How c program execute in c program
 
Operators and it's type
Operators and it's type Operators and it's type
Operators and it's type
 
Chapter 2 - Structure of C++ Program
Chapter 2 - Structure of C++ ProgramChapter 2 - Structure of C++ Program
Chapter 2 - Structure of C++ Program
 
Theatre Booking System Lesson 3
Theatre Booking System   Lesson 3Theatre Booking System   Lesson 3
Theatre Booking System Lesson 3
 
Oot practical
Oot practicalOot practical
Oot practical
 
Data Wrangling Without Coding
Data Wrangling Without CodingData Wrangling Without Coding
Data Wrangling Without Coding
 
Cinfo
CinfoCinfo
Cinfo
 
Removal Of Recursion
Removal Of RecursionRemoval Of Recursion
Removal Of Recursion
 
CalculateLoanPayments
CalculateLoanPaymentsCalculateLoanPayments
CalculateLoanPayments
 
Adding two integers in c
Adding two integers in cAdding two integers in c
Adding two integers in c
 
Tail Recursion in data structure
Tail Recursion in data structureTail Recursion in data structure
Tail Recursion in data structure
 

Similar to Please look at the problems I am having which are listed below: Write a program that inputs 10 inte

Develop a system flowchart and then write a menu-driven C++ program .pdf
Develop a system flowchart and then write a menu-driven C++ program .pdfDevelop a system flowchart and then write a menu-driven C++ program .pdf
Develop a system flowchart and then write a menu-driven C++ program .pdf
leventhalbrad49439
 
Objectives Assignment 09 Applications of Stacks COS.docx
Objectives Assignment 09 Applications of Stacks COS.docxObjectives Assignment 09 Applications of Stacks COS.docx
Objectives Assignment 09 Applications of Stacks COS.docx
dunhamadell
 
R-Language-Lab-Manual-lab-1.pdf
R-Language-Lab-Manual-lab-1.pdfR-Language-Lab-Manual-lab-1.pdf
R-Language-Lab-Manual-lab-1.pdf
KabilaArun
 
R-Language-Lab-Manual-lab-1.pdf
R-Language-Lab-Manual-lab-1.pdfR-Language-Lab-Manual-lab-1.pdf
R-Language-Lab-Manual-lab-1.pdf
attalurilalitha
 
Scanned by CamScannerModule 03 Lab WorksheetWeb Developmen.docx
Scanned by CamScannerModule 03 Lab WorksheetWeb Developmen.docxScanned by CamScannerModule 03 Lab WorksheetWeb Developmen.docx
Scanned by CamScannerModule 03 Lab WorksheetWeb Developmen.docx
anhlodge
 
Objectives 1. using indirect addressing 2. passing parameters.pdf
Objectives 1. using indirect addressing 2. passing parameters.pdfObjectives 1. using indirect addressing 2. passing parameters.pdf
Objectives 1. using indirect addressing 2. passing parameters.pdf
fcsondhiindia
 

Similar to Please look at the problems I am having which are listed below: Write a program that inputs 10 inte (20)

Learning R while exploring statistics
Learning R while exploring statisticsLearning R while exploring statistics
Learning R while exploring statistics
 
Python Programming - II. The Basics
Python Programming - II. The BasicsPython Programming - II. The Basics
Python Programming - II. The Basics
 
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
 
C++ Homework Help
C++ Homework HelpC++ Homework Help
C++ Homework Help
 
Programming basics
Programming basicsProgramming basics
Programming basics
 
Develop a system flowchart and then write a menu-driven C++ program .pdf
Develop a system flowchart and then write a menu-driven C++ program .pdfDevelop a system flowchart and then write a menu-driven C++ program .pdf
Develop a system flowchart and then write a menu-driven C++ program .pdf
 
A01
A01A01
A01
 
Oop lab assignment 01
Oop lab assignment 01Oop lab assignment 01
Oop lab assignment 01
 
Objectives Assignment 09 Applications of Stacks COS.docx
Objectives Assignment 09 Applications of Stacks COS.docxObjectives Assignment 09 Applications of Stacks COS.docx
Objectives Assignment 09 Applications of Stacks COS.docx
 
Tutorial basic of c ++lesson 1 eng ver
Tutorial basic of c ++lesson 1 eng verTutorial basic of c ++lesson 1 eng ver
Tutorial basic of c ++lesson 1 eng ver
 
R-Language-Lab-Manual-lab-1.pdf
R-Language-Lab-Manual-lab-1.pdfR-Language-Lab-Manual-lab-1.pdf
R-Language-Lab-Manual-lab-1.pdf
 
R-Language-Lab-Manual-lab-1.pdf
R-Language-Lab-Manual-lab-1.pdfR-Language-Lab-Manual-lab-1.pdf
R-Language-Lab-Manual-lab-1.pdf
 
R-Language-Lab-Manual-lab-1.pdf
R-Language-Lab-Manual-lab-1.pdfR-Language-Lab-Manual-lab-1.pdf
R-Language-Lab-Manual-lab-1.pdf
 
Ecs 10 programming assignment 4 loopapalooza
Ecs 10 programming assignment 4   loopapaloozaEcs 10 programming assignment 4   loopapalooza
Ecs 10 programming assignment 4 loopapalooza
 
Functions in c++
Functions in c++Functions in c++
Functions in c++
 
Scanned by CamScannerModule 03 Lab WorksheetWeb Developmen.docx
Scanned by CamScannerModule 03 Lab WorksheetWeb Developmen.docxScanned by CamScannerModule 03 Lab WorksheetWeb Developmen.docx
Scanned by CamScannerModule 03 Lab WorksheetWeb Developmen.docx
 
P3
P3P3
P3
 
Objectives 1. using indirect addressing 2. passing parameters.pdf
Objectives 1. using indirect addressing 2. passing parameters.pdfObjectives 1. using indirect addressing 2. passing parameters.pdf
Objectives 1. using indirect addressing 2. passing parameters.pdf
 
Data Structure.pdf
Data Structure.pdfData Structure.pdf
Data Structure.pdf
 

More from licservernoida

More from licservernoida (20)

Biol 1322 crn (course number)name datebiol 1322 crn (c
Biol 1322   crn (course number)name datebiol 1322 crn (cBiol 1322   crn (course number)name datebiol 1322 crn (c
Biol 1322 crn (course number)name datebiol 1322 crn (c
 
Being in the nursing field you will come across many different e
Being in the nursing field you will come across many different eBeing in the nursing field you will come across many different e
Being in the nursing field you will come across many different e
 
Assume that chocolate bliss, the fictitious company in the cours
Assume that chocolate bliss, the fictitious company in the coursAssume that chocolate bliss, the fictitious company in the cours
Assume that chocolate bliss, the fictitious company in the cours
 
Assignment in this assignment you will start on proposing ideas
Assignment in this assignment you will start on proposing ideasAssignment in this assignment you will start on proposing ideas
Assignment in this assignment you will start on proposing ideas
 
Assignment 1-case study assignment questionplease re
Assignment 1-case study assignment questionplease reAssignment 1-case study assignment questionplease re
Assignment 1-case study assignment questionplease re
 
Assignment 1-case study assignment question
Assignment 1-case study assignment question       Assignment 1-case study assignment question
Assignment 1-case study assignment question
 
Assignment strategic planning and financial management pre
Assignment strategic planning and financial management preAssignment strategic planning and financial management pre
Assignment strategic planning and financial management pre
 
Assignment 1 supply and demand videoafter reviewing the video you
Assignment 1 supply and demand videoafter reviewing the video youAssignment 1 supply and demand videoafter reviewing the video you
Assignment 1 supply and demand videoafter reviewing the video you
 
Assignment 1 executive memo you are the ceo of a healthcare or
Assignment 1 executive memo you are the ceo of a healthcare orAssignment 1 executive memo you are the ceo of a healthcare or
Assignment 1 executive memo you are the ceo of a healthcare or
 
Assignment 1 (to be submitted through the assignment submiss
Assignment 1 (to be submitted through the assignment submissAssignment 1 (to be submitted through the assignment submiss
Assignment 1 (to be submitted through the assignment submiss
 
6 the constitution and the new republic· framing a new governme
6 the constitution and the new republic· framing a new governme6 the constitution and the new republic· framing a new governme
6 the constitution and the new republic· framing a new governme
 
2 the dental hygienists guide tonutritional care
2 the dental hygienists guide tonutritional care2 the dental hygienists guide tonutritional care
2 the dental hygienists guide tonutritional care
 
2 healthcares vulnerability to ransomware attacks by abhilas
2 healthcares vulnerability to ransomware attacks by abhilas2 healthcares vulnerability to ransomware attacks by abhilas
2 healthcares vulnerability to ransomware attacks by abhilas
 
1 tenea lewissocw 6301methodological approach
1 tenea lewissocw 6301methodological approach1 tenea lewissocw 6301methodological approach
1 tenea lewissocw 6301methodological approach
 
1 solitary confinementolen jessiedepartment name, p
1 solitary confinementolen jessiedepartment name, p1 solitary confinementolen jessiedepartment name, p
1 solitary confinementolen jessiedepartment name, p
 
1.)what actions and behaviors might a health leader perform to proac
1.)what actions and behaviors might a health leader perform to proac1.)what actions and behaviors might a health leader perform to proac
1.)what actions and behaviors might a health leader perform to proac
 
1.  a family is gathered around in the icu waiting room to monitor t
1.  a family is gathered around in the icu waiting room to monitor t1.  a family is gathered around in the icu waiting room to monitor t
1.  a family is gathered around in the icu waiting room to monitor t
 
1. the writer has used a letter ing system to describe the
1. the writer has used a letter ing system to  describe the 1. the writer has used a letter ing system to  describe the
1. the writer has used a letter ing system to describe the
 
1. for this assignment, i want you to pick a popular song (aim to
1. for this assignment, i want you to pick a popular song (aim to 1. for this assignment, i want you to pick a popular song (aim to
1. for this assignment, i want you to pick a popular song (aim to
 
1. considering the information provided in the case study, do you
1. considering the information provided in the case study, do you 1. considering the information provided in the case study, do you
1. considering the information provided in the case study, do you
 

Recently uploaded

Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...
Krashi Coaching
 
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
 
1029 - Danh muc Sach Giao Khoa 10 . pdf
1029 -  Danh muc Sach Giao Khoa 10 . pdf1029 -  Danh muc Sach Giao Khoa 10 . pdf
1029 - Danh muc Sach Giao Khoa 10 . pdf
QucHHunhnh
 
Beyond the EU: DORA and NIS 2 Directive's Global Impact
Beyond the EU: DORA and NIS 2 Directive's Global ImpactBeyond the EU: DORA and NIS 2 Directive's Global Impact
Beyond the EU: DORA and NIS 2 Directive's Global Impact
PECB
 
BASLIQ CURRENT LOOKBOOK LOOKBOOK(1) (1).pdf
BASLIQ CURRENT LOOKBOOK  LOOKBOOK(1) (1).pdfBASLIQ CURRENT LOOKBOOK  LOOKBOOK(1) (1).pdf
BASLIQ CURRENT LOOKBOOK LOOKBOOK(1) (1).pdf
SoniaTolstoy
 

Recently uploaded (20)

The Most Excellent Way | 1 Corinthians 13
The Most Excellent Way | 1 Corinthians 13The Most Excellent Way | 1 Corinthians 13
The Most Excellent Way | 1 Corinthians 13
 
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...
 
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
 
Software Engineering Methodologies (overview)
Software Engineering Methodologies (overview)Software Engineering Methodologies (overview)
Software Engineering Methodologies (overview)
 
Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...
Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...
Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...
 
1029 - Danh muc Sach Giao Khoa 10 . pdf
1029 -  Danh muc Sach Giao Khoa 10 . pdf1029 -  Danh muc Sach Giao Khoa 10 . pdf
1029 - Danh muc Sach Giao Khoa 10 . pdf
 
Beyond the EU: DORA and NIS 2 Directive's Global Impact
Beyond the EU: DORA and NIS 2 Directive's Global ImpactBeyond the EU: DORA and NIS 2 Directive's Global Impact
Beyond the EU: DORA and NIS 2 Directive's Global Impact
 
Q4-W6-Restating Informational Text Grade 3
Q4-W6-Restating Informational Text Grade 3Q4-W6-Restating Informational Text Grade 3
Q4-W6-Restating Informational Text Grade 3
 
BASLIQ CURRENT LOOKBOOK LOOKBOOK(1) (1).pdf
BASLIQ CURRENT LOOKBOOK  LOOKBOOK(1) (1).pdfBASLIQ CURRENT LOOKBOOK  LOOKBOOK(1) (1).pdf
BASLIQ CURRENT LOOKBOOK LOOKBOOK(1) (1).pdf
 
Measures of Central Tendency: Mean, Median and Mode
Measures of Central Tendency: Mean, Median and ModeMeasures of Central Tendency: Mean, Median and Mode
Measures of Central Tendency: Mean, Median and Mode
 
General AI for Medical Educators April 2024
General AI for Medical Educators April 2024General AI for Medical Educators April 2024
General AI for Medical Educators April 2024
 
A Critique of the Proposed National Education Policy Reform
A Critique of the Proposed National Education Policy ReformA Critique of the Proposed National Education Policy Reform
A Critique of the Proposed National Education Policy Reform
 
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
 
Accessible design: Minimum effort, maximum impact
Accessible design: Minimum effort, maximum impactAccessible design: Minimum effort, maximum impact
Accessible design: Minimum effort, maximum impact
 
Código Creativo y Arte de Software | Unidad 1
Código Creativo y Arte de Software | Unidad 1Código Creativo y Arte de Software | Unidad 1
Código Creativo y Arte de Software | Unidad 1
 
Sports & Fitness Value Added Course FY..
Sports & Fitness Value Added Course FY..Sports & Fitness Value Added Course FY..
Sports & Fitness Value Added Course FY..
 
Advanced Views - Calendar View in Odoo 17
Advanced Views - Calendar View in Odoo 17Advanced Views - Calendar View in Odoo 17
Advanced Views - Calendar View in Odoo 17
 
Disha NEET Physics Guide for classes 11 and 12.pdf
Disha NEET Physics Guide for classes 11 and 12.pdfDisha NEET Physics Guide for classes 11 and 12.pdf
Disha NEET Physics Guide for classes 11 and 12.pdf
 
social pharmacy d-pharm 1st year by Pragati K. Mahajan
social pharmacy d-pharm 1st year by Pragati K. Mahajansocial pharmacy d-pharm 1st year by Pragati K. Mahajan
social pharmacy d-pharm 1st year by Pragati K. Mahajan
 
IGNOU MSCCFT and PGDCFT Exam Question Pattern: MCFT003 Counselling and Family...
IGNOU MSCCFT and PGDCFT Exam Question Pattern: MCFT003 Counselling and Family...IGNOU MSCCFT and PGDCFT Exam Question Pattern: MCFT003 Counselling and Family...
IGNOU MSCCFT and PGDCFT Exam Question Pattern: MCFT003 Counselling and Family...
 

Please look at the problems I am having which are listed below: Write a program that inputs 10 inte

  • 1. Please look at the problems I amhavingwhichare listed below: Write a programthat inputs 10 integers fromthe user into anarray, and removes the duplicate arrayelements. Byremoving, I meant that you should make it appear as ifthe elements hadn't beenthere. So not just settingduplicates to an"empty"value, but fillinginthe gap. That means movingallthe later elements back one (kind oflike whenyouhit backspace inthe middle ofa line ina text editor). Or alternatively, storingonlythe non-repeatingelements. Youmayassume that allthe integers are between0 and 100, Write at least 1 functioninadditionto the mainfunction, and pass anarrayinto that functionas a parameter. Output should look exactlylike below. Two rows. ProgramInput: 0 1 2 3 4 5 6 7 8 9 ProgramOutput: Please enter 10 integers, hittingreturnafter eachone:n 0 1 2 3 4 5 6 7 8 9 ProgramInput: 100 100 100 100 100 100 100 100 100 100 100 ProgramOutput: Please enter 10 integers, hittingreturnafter eachone:n 100 ProgramInput: 11 11 22 22 33 33 44 44 55 55 ProgramOutput: Please enter 10 integers, hittingreturnafter eachone:n 11 22 33 44 55 ProgramInput: 12 37 12 37 45 88 101 21 21 101 ProgramOutput: Please enter 10 integers, hittingreturnafter eachone:n 12 37 45 88 101 21 I have: #include<iostream> usingnamespace std; void eliminate(int a[], int&siz) { int i,n=0; boolb[101]={false}; for(i=0;i<siz;i++) b[a[i]]=true; for(i=0;i<101;i++) if(b[i]) a[n++]=i; siz=n; }
  • 2. int main() { int nums[10]; int i,n=10; cout<<"Please enter 10 integers, hittingreturnafter eachone:n"; for(i=0;i<n;i++) cin>>nums[i]; eliminate(nums,n); cout<<endl; for(i=0;i<n;i++) cout<<nums[i]<<""; return0; } --- PROBLEMS I AM HAVING--- 1) After, cout<<"Please enter 10 integers, hittingreturnafter eachone:n"; I receive 2 "/n"howdo I onlyreceive one "n"after the colon. 2) For mylast output, I receive 12 12 21 37 45 88 whenI should be receiving12 37 45 88 101 21