Tags:
create new tag
view all tags

Using Netbeans with C++

In this activity we will be starting up the NetBeans C++ programming Environment, and trying it on on a simple program. The goal is to make sure we understand the basic programming environment and tools.

NetBeans is an IDE - an Integrated Development Environment. THis means it is a tool for writing, testing, and managing programing activities. It can be used with a variety of languages (such a Java), but we will be using it for the C++ programing language.

Start up NetBeans

  1. Turn on the computer
  2. Log in using your email username, and password
  3. Open the "Installed Software" folder.
  4. Double click the ""NetBeans IDE 8.2" link"

Create a project

  1. Click "File/New Project"
  2. Categories "C/C++"
  3. Projects "C/C++ Application"
  4. "Next >"
  5. Cange project name to "Rectangle"
  6. Finish

Add code

  1. Open the folder "Source Files"
  2. Open "main.cpp"
  3. replace the code with the code below:
//C++ program to find the Area and Perimeter of a Rectangle:

#include<iostream>
using namespace std;

int main()
{
    int width,height,area,perimeter;
    cout<<"Enter  Width of Rectangle = ";
    cin>>width;
    cout<<"Enter  Height of Rectangle = ";
    cin>>height;
    area=height*width;
    cout<<"Area of Rectangle ="<<area<<endl;
    perimeter=2*(height+width);
    cout<<" Perimeter of rectangle are = "<<perimeter<<endl;

    return 0;

}

-- Jim Skon - 2016-08-19

Run the Program

  • Hit the run button (green triangle)
  • Program runs in the "output" window.

Make your own

  • Create a new project, call it "Triangle"
  • Paste the rectangle program in to the main.cpp file
  • Modify to compute the area and perimeter of a triangle.
  • Remember: Area = 1/2(Base * height)

Comments


Edit | Attach | Watch | Print version | History: r4 < r3 < r2 < r1 | Backlinks | Raw View | Raw edit | More topic actions
Topic revision: r4 - 2017-08-23 - JimSkon
 
This site is powered by the TWiki collaboration platform Powered by PerlCopyright © 2008-2018 by the contributing authors. All material on this collaboration platform is the property of the contributing authors.
Ideas, requests, problems regarding TWiki? Send feedback