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 ?
little help ( urgent )
Started by ahmed, Oct 29 2008 03:09 PM
6 replies to this topic
#1
Posted 29 October 2008 - 03:09 PM
|
|
|
#2
Posted 29 October 2008 - 03:28 PM
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 ?
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
Science - Math - Hacking - Tech
#3
Posted 29 October 2008 - 03:33 PM
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
Posted 29 October 2008 - 04:33 PM
Add:
and replace getch() with
If you would like I could come up with a little better version..
#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
Science - Math - Hacking - Tech
#5
Posted 29 October 2008 - 04:40 PM
Part One:
Part Two:
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
Posted 29 October 2008 - 05:07 PM
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
Posted 29 October 2008 - 06:22 PM
All files in the C++ standard library declare all of their entities in the standard (std) namespace.


Sign In
Create Account


Back to top









