Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Learning Objectives: After completing this lab the student will be able to: Use the relational and logical operators to write conditional expressions. Write if statements
Learning Objectives: After completing this lab the student will be able to:
Use the relational and logical operators to write conditional expressions.
Write if statements to select a block to be executed when a conditional expression is true.
Write ifelse statements to select one block or a different block to execute based on the result of a conditional
expression.
Part Relational Operators and the If Statement
In your C IDE, create a new project named Lab Part or something similar. Add a C source code file named lab
cpp to the project. Then copyandpaste the code below into labcpp
PROJECT: Lab Part
FILE: labcpp
DESCR: This project will help you learn the difference between the C
assignment operator and the C relational equality operator
They are completely different operators and they work in completely
different ways.
AUTHOR: Your Name
DATE: The date the project is completed or published
#include
using namespace std;
int main
int num; num is not initialized
int num; num has been initialized to
cout "Please enter an integer" endl;
cin num;
cout "num num and num num endl;
if num num
cout "Hey, thats a coincidence!" endl;
if num num
cout "The values are not the same" endl;
return ;
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started