- Joined
- Jun 5, 2015
- Posts
- 363
- Solutions
- 1
- Reaction
- 140
- Points
- 248
- Age
- 26
Attachments
-
You do not have permission to view the full content of this post. Log in or register now.
#include "stdafx.h"
#include <iostream>
using namespace std;
int main()
{
int array[5];
int sum=0;
cout << "Enter 5 numbers separated by space" <<endl;
for (int i = 0; i < 5; i++)
{
cin >> array[i];
sum = sum + array[i];
}
cout << "Sum =" << sum;
getchar();
getchar();
return 0;
}
#include "stdafx.h"
#include <iostream>
using namespace std;
int main()
{
int SalaryAmount[6] = { 25000,35000,55000,70000,80200,90500 };
int input;
cout << "Enter the salary code (1 through 6):" <<endl;
cin >> input;
if (input < 1 || input >6)
{
cout << "Invalid code";
}
else
{
cout << "Salary: " << SalaryAmount[input - 1];
}
getchar();
getchar();
return 0;
}