HTML Frames

HTML Frames allow multiple html documents to be displayed in a single browser window at a time. Normally frames are used to have a menu in one frame and content in another frame in the same window. By clicking the menu items the targeted document will open in the contents frame. The tag defines how to divide the window into frames Each frameset defines a set of rows or columns. You have to specify the values of rows/columns that indicates that how much screen area each row/column will occupy.

<frameset rows = “20%,70%,10%”>

<frame name = “header” src = “header_frame.html” />
<frame name = “middle” src = “middle_frame.html” />
<frame name = “footer” src = “footer_frame.html” />

<noframes>

<body>If the browser does not support frames.</body>

</noframes>

</frameset>

The src contain the location of the web page that will load into the frame.
You can use the border attribute in the tag to set the frame border. You can also use the framespacing attribute to specify the space between the frames. You can use noresize if you do not let the frames be resized by the visitor. This attribute has no value. Use scrolling attribute to allow scrolling or not inside a frame. Scrolling attribute has values “yes”/”no”

HTML bgcolor Attribute

The bgcolor attribute is used to control the background of an HTML element, specifically page and table backgrounds. bgcolor can be placed within several of the HTML tags. However, we suggest you only use it for your page’s main background and in tables. For additional background styling, check out CSS Backgrounds. The HTML to change the background color is simple:

<body bgcolor=”color name OR RGB Number OR Hex Number”>

Images can be placed within elements of HTML. Tables, paragraphs, and body may all have a background image. To accomplish this, we use the background attribute as follows.

<body background=”background-image.jpg”>

Background Repeat

When your HTML element is larger than the dimensions of your picture, the image simply begins to repeat itself.

font Tag

The tag is used to apply font face, size, and color to the text on your web document. The tag should not be used instead the style attribute should be used.

HTML Introduction

HTML stands for Hyper Text Markup Language. HTML was developed by scientist Tim Berners-Lee in 1990. An HTML file is a text file containing small markup tags. In HTML, we use “tags” to create the structure. These tags tell the browser how to display the text or graphics in the document. HTML file must have an .htm or .html file extension. You can create HTML file using any Text Editor like Notepad or Sublime etc.

Introduction to C++

C++ is a programming language which allow you to control your computer, making it do what you want it to do. This programming tutorial series is all about helping you to take full advantage of C++.

C++ Compilers

The very first thing you need to do, before starting out in C++, is to make sure that you have a compiler. What is a compiler, you ask? A compiler turns the program that you write into a executable that your computer can actually understand and run. If you’re taking a course, you probably have one provided through your school. If you’re starting out on your own, your best bet is to use Code::Blocks. Our page on setting up Code::Blocks will take you through setting up the Code::Blocks compiler in great detail.

Introduction to the C++

A C++ program is a collection of commands, which tell the computer to do “something”. This collection of commands is usually called C++ source code, source code or just code. Commands are either “functions” or “keywords”. Keywords are a basic building block of the language, while functions are, in fact, usually written in terms of simpler functions–you’ll see this in our very first program, below. (Confused? Think of it a bit like an outline for a book; the outline might show every chapter in the book; each chapter might have its own outline, composed of sections. Each section might have its own outline, or it might have all of the details written up.) Thankfully, C++ provides a great many common functions and keywords that you can use.

But how does a program actually start? Every program in C++ has one function, always named main, that is always called when your program first executes. From main, you can also call other functions whether they are written by us or, as mentioned earlier, provided by the compiler.

So how do you get access to those prewritten functions? To access those standard functions that comes with the compiler, you include a header with the #include directive. What this does is effectively take everything in the header and paste it into your program.

Let’s look at a working program:

#include <iostream>

using namespace std;

int main()
{

cout<<“Hello World!\n”;
cin.get();

}

The #include is a “preprocessor” directive that tells the compiler to put code from the header called iostream into our program before actually creating the executable. By including header files, you gain access to many different functions.

The next important line is int main(). This line tells the compiler that there is a function named main, and that the function returns an integer, hence int. The “curly braces” ({ and }) signal the beginning and end of functions and other code blocks. You can think of them as meaning BEGIN and END.

In C++, however, the cout object is used to display text (pronounced “C out”). It uses the << symbols, known as “insertion operators”, to indicate what to output. cout<< results in a function call with the ensuing text as an argument to the function. The quotes tell the compiler that you want to output the literal string as-is. The ‘\n’ sequence is actually treated as a single character that stands for a new line.

The next command is cin.get(). This is another function call: it reads in input and expects the user to hit the return key. Many compiler environments will open a new console window, run the program, and then close the window. This command keeps that window from closing.

Upon reaching the end of main, the closing brace, our program will return the value of 0 (and integer, hence why we told main to return an int) to the operating system. This return value is important as it can be used to tell the OS whether our program succeeded or not. A return value of 0 means success and is returned automatically (but only for main, other functions require you to manually return a value), but if we wanted to return something else, such as 1, we would have to do it with a return statement:

#include <iostream>

using namespace std;

int main()
{

cout<<“Hello World!\n”;
cin.get();

return 1;

}

C++ Comments

When you tell the compiler a section of text is a comment, it will ignore it when running the code, allowing you to use any text you want to describe the real code. To create a comment use either //, which tells the compiler that the rest of the line is a comment, or /* and then */ to block off everything between as a comment. Certain compiler environments will change the color of a commented area, but some will not. Be certain not to accidentally comment out code (that is, to tell the compiler part of your code is a comment) you need for the program. When you are learning to program, it is useful to be able to comment out sections of code in order to see how the output is affected.

Variables in C++

Variables are reserved memory locations which are used to store various information which means that some space in memory will be reserved for that variable.

A variable of type char stores a single character, variables of type int store integers (numbers without decimal places), and variables of type float store numbers with decimal places. Each of these variable types – char, int, and float – is each a keyword that you use when you declare a variable.

Using the right variable type can be important for making your code readable and for efficiency–some variables require more memory than others. Moreover, because of the way the numbers are actually stored in memory, a float is “inexact”, and should not be used when you need to store an “exact” integer value.

Declaring Variables in C++

Here are some variable declaration examples:

int x;
char letter;
float the_float;

It is permissible to declare multiple variables of the same type on the same line; each one should be separated by a comma.

int a, b, c, d;

If you were watching closely, you might have seen that declaration of a variable is always followed by a semicolon.

Common Errors when Declaring Variables in C++

If you attempt to use a variable that you have not declared, your program will not be compiled or run, and you will receive an error message informing you that you have made a mistake. Usually, this is called an undeclared variable.

#include <iostream>

using namespace std;

int main()
{

int thisisanumber;

cout << “Please enter a number: “; cin >> thisisanumber;
cin.ignore();
cout << “You entered: ” << thisisanumber << “\n”;
cin.get();

}