تم الحل ✓
categoryبرمجة وتطوير البرمجيات
schoolبكالوريوس
event_available2026-07-15
السؤال
Transcribed Image Text:
No Service
2:36 AM
< Lab 1 - Introduction to Visual St...
Lab #1
Objectives
1 To be able to create a C/C++ program using Visual Studio
2 To be able to compile C code and run it
3 To become familiar with the Visual Studio IDE
Program 1:
i. Create a new project and source file.
ii. Copy the following program.
/* Program 1
Programmer name: type your name here
The purpose of the program: Enter the name and year of birth
calculate the age of the user */
#include <string> //Pre-processor directive required for Strings
#include <iostream> //Pre-processor directive
using namespace std;
int main()
{
}
const int Current Year 2019;
string Name;
int YearOfBirth, Age;
cout<<"Please,enter your first name:";
cin>> Name;
cout<<"Please,enter your year of birth: ";
cin>>YearOfBirth;
Age Current Year - YearOfBirth;
cout << "Your name: "<<Name << endl;
cout<<"Your age is: " << Age <<" years.";
return 0;
iii. Save, compile, and run the Program 1 above.
iv. Briefly describe what each line of code means.
95% 47
No Service
2:36 AM
Lab 1 - Introduction to Visual St...
Program 2:
i. Create a new project and source file.
ii. Copy the following program.
//Program 2
// Programmer name:
#include <iostream>
using namespace std;
int main()
{
}
int workDays;
float workHours, payRate, weeklyPay;
workDays = 5;
workHours
6.5;
payRate 20.50;
weekly Pay workDays* workHours * payRate;
cout << "Weekly Pay = "<< weeklyPay << endl;
return 0;
iii. Save, compile, and run Program 2 above.
iv. Briefly describe what each line of code means.
95% C
Program 3:
i. In Program 1 above, Current Year is defined as a constant (2019).
Make a copy of the program in a new file, make changes so that the
Current Year is entered by the user.
ii. Compile, and run.
Program 4:
i. Write a program that asks the user to enter two float numbers (num1
and num2), obtains the numbers from the user (keyboard) and
calculates their addition, subtraction, multiplication and division.
ii. Compile, and run.
3
check_circle الجواب — حل مفصل خطوة بخطوة
hourglass_top
🔒
الحل الكامل متاح للمشتركين
اشترك في أرشيف الأسئلة لعرض هذا الحل وآلاف الحلول المفصلة خطوة بخطوة من معلمين معتمدين.