logo

OOPS Concepts: C++

   

Added on  2022-11-16

10 Pages1216 Words314 Views
 | 
 | 
 | 
Running head: OOPS CONCEPTS: C++
OOPs concepts: C++
Name of the Student
Name of the Course
Instructor
Date
OOPS Concepts: C++_1

OOPS CONCEPTS: C++1
String Input Console Application and Program Analysis (#1)
Introduction
C++ is an object oriented approach for programming where the name clearly suggests
that it uses objects. The C++ is an extension of C program where the OOPs concept is included.
It is developed by Bjarne stroutstrup at bell labs (Stroustrup, 2013). As it is known that OOPs
has six major characteristics named polymorphism, inheritance, abstraction, encapsulation, class
and objects. A class is consist with several objects, functions and data variables. The analysis of
advantages and concepts of using C++ along with string operation, its vulnerabilities and ideal
solutions has been done here using C++ compiler.
Program: (String Reverse)
#include <iostream>
#include <cstring>
using namespace std;
//Function will count and return the length if the string
int find_length(char string_input[]){
//Declaring the variables
int counter;
//Counting the the length of the string
for(counter=0;string_input[counter]!='\0';++counter);
OOPS Concepts: C++_2

OOPS CONCEPTS: C++2
//returns the counted length
return counter;
}
//Function Will reverse the string
void reverse_string(char string_input[],int length){
//Declaring the variables
int i,counter = length - 1;
char reversed_string[100];
//Reversing the string using loops
for(i = 0;i < length;i++){
reversed_string[i] = string_input[counter];
counter--;
}
reversed_string[i] = '\0';
//Printing the reversed string
cout<<"String after reversing: "<<reversed_string;
OOPS Concepts: C++_3

End of preview

Want to access all the pages? Upload your documents or become a member.

Related Documents