#include
@pitamar plz help
Just some hints from first glance: First I'd do `#include <iostream>` without the `.h` that's the way using C++ standard libraries (as opposed to C) Second, those libraries come with `std` namespace, means you have have to call the functions with `std::cin`, `std::cout` and such.. unless you compiler add it implicitly. A quickfix (OK for small programs, not recommended for big ones) is to add `using namespace std;` below the `#include` statement so: ```cpp #include <iostream>; using namespace std; ``` Third you forgot to print `endl` for ending the lines when you do `cout`. for example: ```cpp cout<<"Odd:"<<odd<<endl; ``` Now let me try to compile hehe
Also from looking.. isn't the `isum=0` supposed to be `i=0`?
thx alot
works?
there is still errors:(
ye I just tried to compile, lemme see :)
you have a typo at `cin>>lowerlimt` it supposed to be `cin>>lowerlimit` Also you do not have a closing `}` after line 15 it should be ``` if(sum % 2 == 0) { even++; } // <--- else { odd++; } ```
oh ye, and in the code I copied you forgot a space after the `#include` it should be `#include <iostream>` not `#include<#iostream>`
22 1 C:\Dev-Cpp\Untitled57.cpp [Error] expected '}' at end of input
post the code, too many changes lol
#include<iostream> using namespace std; int main() { int lowerlimit,upperlimit,i=0,even=0,odd=0,sum; cout<<"Enter the lower limit"; cin>>lowerlimit; cout<<"Enter the upper limit"; cin>>upperlimit; for(i=lowerlimit;i<=upperlimit;i++){ sum = i+sum; cout<<sum; if(sum % 2 == 0) { even++;} else { odd++; } cout<<"Even :"<<even<<endl; cout<<"Odd:"<<odd<<endl; }
I got something working out of it here: ```cpp #include <iostream> using namespace std; int main() { int lowerlimit,upperlimit,i=0,even=0,odd=0,sum=0; cout<<"Enter the lower limit"; cin>>lowerlimit; cout<<"Enter the upper limit"; cin>>upperlimit; for(i=lowerlimit;i<=upperlimit;i++){ sum = i+sum; cout << sum <<endl; if(sum % 2 == 0) { even++; } else { odd++; } } cout<<"Even :"<<even<<endl; cout<<"Odd:"<<odd<<endl; } ```
thanks alot finally i got it:)
sure no problem =)
Join our real-time social learning platform and learn together with your friends!