Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
C++ episode 4(Variables).
#1
Welcome to my fourth tutorial about C++.

Today we will talk about integers.

(input)
Code:
#include<iostream>

using namespace std;

int main()
{
    int x;
    float y;
    double j;
    char q;

   x=5;
   y=5.32;
   j=5.324354231;
   q='a';

cout<<x<<endl;
cout<<y<<endl;
cout<<j<<endl;
cout<<q<<endl;


}

(output)
Code:
5
5.32
5.32435
a

(explanation)
Code:
#include<iostream>

using namespace std;

int main()
{
    int x;//we define the <x> as integer.
    float y;//we define the <y> as demical.
    double j;//we define the <j> as demical with more digits.
    char q;//we define the <q> as character(only one.).For more characters will talk later.

   x=5;//give value an integer number.
   y=5.32;//give value an demical number.
   j=5.324354231;//give value an demical number with more digits.
   q='a';//give value a character using this<'...'>.

cout<<x<<endl;//print the <x>.
cout<<y<<endl;//print the <y>.
cout<<j<<endl;//print the <j>.
cout<<q<<endl;//print the <q>.


}


I think that you understood some basic about variables in c++.

(i am sorry for my enlgish,i just try to learn you,some things which i know.)

next tut come soon.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)