Most of our features and services are available only to members, so we encourage you to login or register a new account. Registration is free, fast and simple. You only need to provide a valid email. Being a member you'll gain access to all member forums and features, post a message to ask question or provide answer, and share or find resources related to mobile phones, tablets, computers, game consoles, and multimedia.
All that and more, so what are you waiting for, click the register button and join us now! Ito ang website na ginawa ng pinoy para sa pinoy!
Thank you po sir!
/* A c++ program example that demonstrate the working of logical operators. */
// Program 1
#include <iostream>
using namespace std;
int main ()
{
cout << "3 > 2 && 3 > 1: " << (3 > 2 && 3 > 1) << endl;
cout << "3 > 2 && 3 < 1: " << (3 > 2 && 3 < 1) << endl;
cout << "3 < 2 && 3 < 1: " << (3 < 2 && 3 < 1) << endl;
cout << endl;
cout << "3 > 2 || 3 > 1: " << (3 > 2 || 3 > 1) << endl
cout << "3 > 2 || 3 < 1: " << (3 > 2 || 3 < 1) << endl;
cout << "3 < 2 || 3 < 1: " << (3 < 2 || 3 < 1) << endl;
cout << endl;
cout << "! (3 == 2): " << ( ! (3 == 2) ) << endl;
cout << "! (3 == 3): " << ( ! (3 == 3) ) << endl;
return 0;
}
/* A c++ program example that uses a logical operator in selection statement if-else.*/
// Program 2
#include <iostream>
#include <string>
using namespace std;
const string userName = "computergeek";
const string passWord = "break_codes";
int main ()
{
string name, pass;
cout << "Username: ";
cin >> name;
cout << "Password: ";
cin >> pass;
if (name == userName && pass == passWord)
{
cout << "You are logged in!" << endl;
}
else
cout << "Incorrect username or password." << endl;
return 0;
}
/* A simple c++ program example that uses AND logical operator */
// Program 3
#include <iostream>
#include <iomanip>
using namespace std;
int main ()
{
int first, second, third;
cout << "Enter three integers." << endl;
cout << "First "<< setw (3) << ": ";
cin >> first;
cout << "Second "<< setw (2) << ": ";
cin >> second;
cout << "Third "<< setw (3) << ": ";
cin >> third;
if (first > second && first > third)
cout << "first is greater than second and third." << endl;
else if (second > first && second > third)
cout << "second is greater than first and third." << endl;
else if (third > first && third > second)
cout << "third is greater than first and second." << endl;
else
cout << "first, second and third are equal." << endl;
return 0;
}
/* A simple c++ program example that uses OR logical operator*/
// Program 4
#include <iostream>
using namespace std;
int main ()
{
char agree;
cout << "Would you like to meet me (y/n): ";
cin >> agree;
if (agree == 'y' || agree == 'Y')
{
cout << "Your name: ";
string name;
cin >> name;
cout << "Glad to see you, "+name << endl;
}
else if (agree == 'n' || agree == 'N')
cout << "See you later!" << endl;
else
cout << "Please enter 'y' or 'n' for yes or no." << endl;
return 0;
}
/* A simple c++ program example that uses NOT logical operator*/
// Program 5
#include <iostream>
using namespace std;
int main ()
{
char agree;
cout << "Would you like to meet me?" << endl;
cout << "Press 'y' for yes and any other character for no: ";
cin >> agree;
if ( ! (agree == 'y' || agree == 'Y') )
{
cout << "See you later!" << endl;
}
else
{
cout << "Your name: ";
string name;
cin >> name;
cout << "Glad to see you, "+name << "!" << endl;
}
return 0;
}
okay sirpa BM at ng makasali nga rn pra mareview or marefresh q ung knowledge q sa C++...
okay sir..gagawan natin ng program yanmga idol need help naman sa prelim namin ,about c++ po sya ..gagawa daw po kami ng program na about buying eggs ..parang computerized way ng pagbili ng egg samin ..bale ganito po dapat lalabas pagnirun na sya ..
"Enter no. of eggs :
# of dozens :
and :
Price :
Total :
Due :
Change : "
sana po may makatulong sakin ..next week na po ipapasa namin yun
sige lang sirpa BM~!
#include <iostrem> -- as far as i know..sya ang responsible sa input and outputtanong lang po kung ok lang
pra saan po un
#include <string>
#include <iostream>
#include <iomanip>?
mga idol need help naman sa prelim namin ,about c++ po sya ..gagawa daw po kami ng program na about buying eggs ..parang computerized way ng pagbili ng egg samin ..bale ganito po dapat lalabas pagnirun na sya ..
"Enter no. of eggs :
# of dozens :
and :
Price :
Total :
Due :
Change : "
sana po may makatulong sakin ..next week na po ipapasa namin yun
pahelp po.
Create a program that will find the minimum,maximum and average values of a collection of numbers. The program will
constinuously accept a value and give the average but terminated when zero is entered.
ito na po idol yung mga price ng mga eggs ,
"1-5 dozens=8 pesos
6-8 dozen=7.50 pesos
9-10 dozens=7pesos
11-13=6.50 pesos
14-pataas=6 pesos"
wait ko mga idol
screenshot:
eto yung nagawa ko
antayin mo si diaven
may mas better program sya dito ^_^
with error and trapping na yung kanya.
code:
http://*** BANNED LINK - DO NOT POST ***/4gssRYEC