What is CPP?
Cpp programming (pronounced see plus plus) is general-purpose programming language. Cpp programming is regarded as a "middle-level" language, as it comprises a combination of both high-level and low-level language features. It was developed by Bjarne Stroustrup starting in 1979 at Bell Labs as an enhancement to the C programming language and originally named C with Classes. It was renamed Cpp programming in 1983.As one of the most popular programming languages ever created, C++ programming is widely used in the software industry. Some of its application domains include systems software, application software, device drivers, embedded software, high-performance server and client applications, and entertainment software such as video games.
Here you will find cpp programs and cpp class example.This is just example you can modify this cpp class example.
cpp programs
Cpp practice work examplecpp source codes for count word from txt file
/* ******************************************************************** This cpp program counts word from file. author-Nikunj v Gandhi from-gujarat(surat) Web Developer(PHP ZCE) email-nik_gandhi007@yahoo.com http//my-source-codes.blogspot.com ******************************************************************** */ #include<fstream.h> #include<stdio.h> #include<string.h> #include<conio.h> class word { char *str; public: word() { str="nikunj v gandhi"; } word(char *string) { strcpy(str,string); } void input() { cout<<"Enter string?"; gets(str); } void exword(); }; void word::exword() { int len=strlen(str); str[len]=' '; ofstream out("z:/cpp/cppfile/countword.txt"); /* change path according to your computer path*/ out<<str; out.close(); ifstream in("z:/cpp/cppfile/countword.txt"); /* change path according to your computer path*/ char ch; char substr[20]; int i,j=0,p,m=0; int k; while(in) { in.get(ch); if(ch==32) { m++; if(m==1) { substr[j]='\0'; p=0; while(substr[p]!=0) { cout<<substr[p]; p++; } cout<<"\n"; substr[0]='\0'; j=0; m++; } } else if(ch!=32) { m=0; substr[j]=ch; j++; } } in.close(); } void main() { clrscr(); word w("nikunj v gandhi "); w.input(); w.exword(); getch(); }
No comments:
Post a Comment