Symbianize Forum

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!

-= Having Difficulties in C++ and Java? Be a Part of This Thread =-

Re: -= Having Difficulty in C++? Be a Part of This Thread =-

Thank you po sir!:salute:
 
Re: -= Having Difficulty in C++? Be a Part of This Thread =-

The three logical operators ( AND, OR and NOT ) are as follows:

1) AND (&&) : Returns true only if both operand are true.
2) OR (||) : Returns true if one of the operand is true.
3) NOT (!) : Converts false to true and true to false.


Code:
/* 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;
}

Code:
/* 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;
}

Code:
/* 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;
}

Code:
/* 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;
}

Code:
/* 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;
}

:thumbsup:
 
Last edited:
Re: -= Having Difficulty in C++? Be a Part of This Thread =-

pa BM at ng makasali nga rn pra mareview or marefresh q ung knowledge q sa C++...
 
Re: -= Having Difficulty in C++? Be a Part of This Thread =-

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 :pray::pray::weep:
 
Re: -= Having Difficulty in C++? Be a Part of This Thread =-

pa BM~!
 
Re: -= Having Difficulty in C++? Be a Part of This Thread =-

tanong lang po kung ok lang
pra saan po un
#include <string>
#include <iostream>
#include <iomanip>?
 
Re: -= Having Difficulty in C++? Be a Part of This Thread =-

pa BM at ng makasali nga rn pra mareview or marefresh q ung knowledge q sa C++...
okay sir :salute:

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 :pray::pray::weep:
okay sir..gagawan natin ng program yan

sige lang sir :salute:

tanong lang po kung ok lang
pra saan po un
#include <string>
#include <iostream>
#include <iomanip>?
#include <iostrem> -- as far as i know..sya ang responsible sa input and output

#include <string> -- ito ang responsible sa pag-input ng stringyung bang mga words :)
 
Re: -= Having Difficulty in C++? Be a Part of This Thread =-

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.
 
Re: -= Having Difficulty in C++? Be a Part of This Thread =-

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 :pray::pray::weep:


hindi ko ma-gets yung output..

ano pinagkaiba nito?"Enter no. of eggs : at # of dozens :

saka ano ilalagay sa "and:"?

yung total? di ko alam kung para saan kasi one time lang naman yata magiinput kung ilan ang itlog na bibilhin..

yung due yung iinput mo kung magkano ang ibinayad mo?

more details pa sana sa sinasabi mong program :thumbsup:
 
Re: -= Having Difficulty in C++? Be a Part of This Thread =-

@raymundpogi thanks po:thumbsup:
 
Re: -= Having Difficulty in C++? Be a Part of This Thread =-

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.


eto gawa ng magaling kong girlfriend :lol:

imodify mo na lang sa pag zero ang inenter magterminate yung program para hindi naman spoonfeed :thumbsup:

MinMaxAve

attach ko na din yung exe file para sa output, rename mo lang then remove mo yung .zip sa filename :thumbsup:
 

Attachments

  • minmaxave.exe.zip
    464.5 KB · Views: 29
Re: -= Having Difficulty in C++? Be a Part of This Thread =-

yung sakin po bale yung ''and'' s baba ng no. of dozens ay yung sobrang eggs na hindi inabot ng dozen yung bilang ..parang 20 eggs ang ininput tapos ,1 for the "no. of dozens" then yung 8 eggs mapupunta sa "and" ..yung "due" naman po ay yung bayad ng customer ..mamat mga idol !^^
 
Re: -= Having Difficulty in C++? Be a Part of This Thread =-

ay tsaka nga po pala may price din yung mga eggs depende kung ilan bibilhin ..parang may discount pag mas marami bibilhin ..wait lang po ah ,tatanungin ko pa po pagpasok ko maya yung list ng mga price ,di ko po kasi nasulat kakamadali ko
 
Re: -= Having Difficulty in C++? Be a Part of This Thread =-

yung hindi ko po nasagotan.bukas nalang po..kasi..wala nman kaming pasok bukas..hehe
 
Re: -= Having Difficulty in C++? Be a Part of This Thread =-

okz lang idol ,sa monday pa naman isasubmit yan ..post ko maya idol yung price ng mga eggs
 
Re: -= Having Difficulty in C++? Be a Part of This Thread =-

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 :yipee::yipee:
 
Re: -= Having Difficulty in C++? Be a Part of This Thread =-

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 :yipee::yipee:

screenshot:
attachment.php


eto yung nagawa ko :lol:

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


:salute:
 

Attachments

  • cpe1213.jpg
    cpe1213.jpg
    28 KB · Views: 97
  • egg.zip
    124.1 KB · Views: 21
Re: -= Having Difficulty in C++? Be a Part of This Thread =-

yes masarap tong c++ kainin ^_^ kuya pwede po bang example ng mga program tungkol sa arrays and loopings d ko magets kasi hirap anu po ba gagawin ko para madali kong maintindihan yun?
 
Re: -= Having Difficulty in C++? Be a Part of This Thread =-



screenshot:
attachment.php


eto yung nagawa ko :lol:

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


:salute:

wow! haha ..ang galing nyo naman ma'am !hehe ..kunin ko na po muna to ,ask ko yung mga kgrupo ko kung pwede na yung ganito ..salamat po ng marami !!:yipee::yipee::clap::clap:
 
Back
Top Bottom