Jump to content

little help ( urgent )

- - - - -

This topic has been archived. This means that you cannot reply to this topic.
6 replies to this topic

#1
ahmed

ahmed

    Programming Professional

  • Members
  • PipPipPipPipPip
  • 304 posts
I have an assignment to do and I cant understand these 2 parts
d)Calculate the remainder after q is divided by divisor and assign the result to q,Write this statement in two different ways.
b)Test if the value of the varaible count is greater then 10.if it is ,print ”count is greater then 10”.


Wanted to ask what is a variable count ?

#2
LogicKills

LogicKills

    Programmer

  • Members
  • PipPipPipPip
  • 139 posts

ahmed said:

I have an assignment to do and I cant understand these 2 parts
d)Calculate the remainder after q is divided by divisor and assign the result to q,Write this statement in two different ways.
b)Test if the value of the varaible count is greater then 10.if it is ,print ”count is greater then 10”.


Wanted to ask what is a variable count ?

the value of the var.
http://logickills.org
Science - Math - Hacking - Tech

#3
ahmed

ahmed

    Programming Professional

  • Members
  • PipPipPipPipPip
  • 304 posts
int main()
{
int vcount;
cout<<"\n Enter Value : ";
cin>>vcount;
if(vcount>10)
cout<<"\n count is greater then 10 ";
else
cout<<"\n End ";
getch();
return 0;
}


is this code correct then and help with the 1st part plz (:

#4
LogicKills

LogicKills

    Programmer

  • Members
  • PipPipPipPip
  • 139 posts
Add:
#include <iostream> 

                 using namespace std;



and replace getch() with
cin.get();


If you would like I could come up with a little better version..
http://logickills.org
Science - Math - Hacking - Tech

#5
Steve.L

Steve.L

    Programming Expert

  • Members
  • PipPipPipPipPipPip
  • 444 posts
Part One:
q = q % x;   // x is your "divisor", % is modulus.

Part Two:
if (count > 10) cout << "Variable 'count' is greater than ten." << endl;
else cout << "Variable 'count' is not greater than ten." << endl;


#6
ahmed

ahmed

    Programming Professional

  • Members
  • PipPipPipPipPip
  • 304 posts
Thanks LogicKills and Steve.L , last thing i wanted to ask that y do we use "using namespace std;" abd cin.get() performs the same function as getch() ? ?

#7
Steve.L

Steve.L

    Programming Expert

  • Members
  • PipPipPipPipPipPip
  • 444 posts
All files in the C++ standard library declare all of their entities in the standard (std) namespace.