sum 2 of the number that i insert to the program and must be equal with the number i have in the begin

For c++

The program must read a number for the money that i have (this is okay ) after it read a number with quantity of numbers that will read the program (and this is okay ) the question is : how can i sum 2 of the number that i insert to the program and must be equal with the money i have in the begin ! how can i do this ? i also want to know in what position is in the program .
e.x
100
3
5 75 25
Can anyone help me please ?


1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
 #include<iostream>
#include <iostream>
#include <algorithm>
#include <iterator>
#include <utility>
using namespace std;

int main (){
int a,b,c;

float p[100000];
int pos = 0;
int pos1;
int pos2;
int sum;

cin>>a;
cin>>b;
for (int i=0; i<=b; i++){
    cin>>p[i];
sort(p,p+b);
do{
    sum=(p[i]+p[i+1]);

}while(sum=a);

}
cout<<p[i]<<p[i+1];
return 0;
}
Last edited on
Topic archived. No new replies allowed.