0% found this document useful (0 votes)
16 views

Macro Preprocessor C C++ Programming Languages Header Files Macro Conditional Compilation Program Compiler

The preprocessor or cpp is a program that is invoked by C and C++ compilers as the first step of translation. It provides functionality like including header files, macro expansion, and conditional compilation. While related to C, the preprocessor directive language can also process other text files.

Uploaded by

Vei Adoptante
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
16 views

Macro Preprocessor C C++ Programming Languages Header Files Macro Conditional Compilation Program Compiler

The preprocessor or cpp is a program that is invoked by C and C++ compilers as the first step of translation. It provides functionality like including header files, macro expansion, and conditional compilation. While related to C, the preprocessor directive language can also process other text files.

Uploaded by

Vei Adoptante
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 2

The C preprocessor or cpp is the macro preprocessor for the C and C++ computer programming

languages. The preprocessor provides the ability for the inclusion of header files, macro
expansions, conditional compilation, and line control.
In many C implementations, it is a separate program invoked by the compiler as the first part of
translation.
The language of preprocessor directives is only weakly related to the grammar of C, and so is
sometimes used to process other kinds of text files.
2.
#include <iostream>
#include<conio.h>
using namespace std;
// Class Declaration
class person
{
//Access - Specifier
public:
//Varibale Declaration
string name;
int number;
};
//Main Function
int main()
{
// Object Creation For Class
person obj;
//Get Input Values For Object Varibales
cout<<"Enter the Name :";
cin>>obj.name;
cout<<"Enter the Number :";
cin>>obj.number;
//Show the Output
cout << obj.name << ": " << obj.number << endl;

getch();
return 0;

2.
#include <iostream>
using namespace std;

int main ()
{
int i;
cout << "Please enter an integer value: ";
cin >> i;
cout << "The value you entered is " << i;
cout << " and its double is " << i*2 << ".\n";
return 0;
}

3.
// stringstreams
#include <iostream>
#include <string>
#include <sstream>
using namespace std;
int main ()
{
string mystr;
float price=0;
int quantity=0;
cout << "Enter price: ";
getline (cin,mystr);
stringstream(mystr) >> price;
cout << "Enter quantity: ";
getline (cin,mystr);
stringstream(mystr) >> quantity;
cout << "Total price: " << price*quantity << endl;
return 0;
}

You might also like