well guys Im trying to make a problem from my book but this time has happened something really weird just compile it ah and the problem is this btw:
1. Write a program that requests the user to enter two integers. The program should then
calculate and report the sum of all the integers between and including the two integers.
At this point, assume that the smaller integer is entered first. For example, if the user
enters 2 and 9, the program should report that the sum of all the integers from 2 through
9 is 44.
so I did:
#include <iostream>
using namespace std;
int main()
{
int x;
int z;
int w;
int y;
cout << "Enter the first integrer: ";
cin >> x;
cout << endl;
cout << "Enter the second integrer: ";
cin >> z;
cout << endl;
for (y = x; x > z; y++)
cin >> y;
for (w = z; z > x; w++)
cin >> w;
if (x > z)
{
cout << y;
}
if (z > x)
{
cout << w;
}
system("pause");
return 0;
}
well this time I did it fast but I think that it has something wrong but I hope that the answer is close to this source or I will cry
can somebody help me plz?
award: +1 karma