I\'ve wrote this code, and it shows an awkward problem. The code is: #include \"
ID: 3628301 • Letter: I
Question
I've wrote this code, and it shows an awkward problem. The code is:#include "stdafx.h"
#include <iostream.h>
#include <iomanip.h>
using namespace std;
void main()
{
for(int j=0;j<5;j++)
{
cout<<"Please enter 2 positive whole numbers:"<<endl;
int num1,num2,i;
cin>>num1;
cin>>num2;
if(num1<1||num2<1)
cout<<"Error :Condition 1 is not met."<<endl;
else
{
int sumEven=0, sumOdd=0,sum4=0;
int min = num1,max = num2;
if(min>max)
{
min = num2;
max=num1;
}
for(i=min+1;i<max;i++)
{
if((i%2) == 0)
sumEven = sumEven+ i;
else
sumOdd = sumOdd + i;
if((i%4)==0)
sum4 = sum4 +i;
}
if(sumEven == 0)
cout<<"This set of numerical values does not include even integers."<<endl;
else
{
for(i=min+1;i<max;i++)
{
if((i%2)==0)
cout<<i<<" ";
}
cout<<setw(20)<<sumEven<<endl;
}
if(sumOdd == 0)
cout<<"This set of numerical values does not include odd integers."<<endl;
else
{
for(i=min+1;i<max;i++)
{
if((i%2)!=0)
cout<<i<<" ";
}
cout<<setw(20)<<sumOdd<<endl;
}
if(sum4 == 0)
cout<<"This set of numerical values does not include integers that are divisible by 4."<<endl;
else
{
for(i=min+1;i<max;i++)
{
if((i%4)==0)
cout<<i<<" ";
}
cout<<setw(30)<<sum4<<endl;
}
}
}
}
the problem is this error:
1> fatal error C1083: Cannot open include file: 'iostream.h': No such file or directory
please note, I'm using visual studio 2010.
Explanation / Answer
Drop the .h from iostream and iomanip. (e.g. #include ) Verified in VC++ 2008.Related Questions
Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.