They provide an intersection between technology, social interaction, and the sharing of information
Answer:
21212122121221212211212121212212121Explanation:
#include<stdio.h>
#include<stdlib.h>
int comment1(FILE *fp)
{
char ch;
int count=0;
while(fscanf(fp,"%c",&ch)!=EOF)
{
if(ch=='\n')
{
return count;
}
count++;
}
return count;
}
int comment2(FILE *fp)
{
char ch;
int count=0;
while(fscanf(fp,"%c",&ch)!=EOF)
{
if(ch=='*')
{
fscanf(fp,"%c",&ch);
if(ch=='/')
{
return count;
}
count++;
}
count++;
}
return 0;
}
int main()
{
printf("Enter the file name:");
char s[1000],ch,ch1;
scanf("%s",s);
FILE*fp;
fp = fopen(s,"r");
int count=0;
while(fscanf(fp,"%c",&ch)!=EOF)
{
if(ch=='\"')
{
while(fscanf(fp,"%c",&ch)!=EOF)
{
if(ch=='\"')
{
break;
}
if(ch=='\\')
{
fscanf(fp,"%c",&ch);
}
}
}
else if(ch=='/')
{
fscanf(fp,"%c",&ch);
if(ch=='/')
{
count += comment1(fp);
}
else if(ch=='*')
{
count += comment2(fp);
}
}
}
printf("%d\n",count);
return 0;
}
Answer:
In C++:
#include<iostream>
#include<vector>
using namespace std;
int main(){
int len, num;
vector<int> vect;
cout<<"Length: ";
cin>>len;
for(int i = 0; i<len;i++){
cin>>num;
vect.push_back(num);}
vector<int>::iterator iter;
for (iter = vect.end() - 1; iter >= vect.begin(); iter--){
cout << *iter << ", ";}
}
Explanation:
This declares the length of vector and input number as integer
int len, num;
This declares an integer vector
vector<int> vect;
This prompts the user for length
cout<<"Length: ";
This gets the input for length
cin>>len;
The following iteration gets input into the vector
<em> for(int i = 0; i<len;i++){</em>
<em> cin>>num;</em>
<em> vect.push_back(num);}</em>
This declares an iterator for the vector
vector<int>::iterator iter;
The following iterates from the end to the beginning and prints the vector in reverse
<em> for (iter = vect.end() - 1; iter >= vect.begin(); iter--){</em>
<em> cout << *iter << ", ";}</em>
<em />
<em />
Answer:
The system call is the programming way for executing the requesting the services in the program from kernel in the particular operating system.
The main purpose of the system call in the operating system is that it basically provide the different types of the services to the users by using the API (Application program interface) system.
It basically provide the interface for allowing the users to request the services between the operating system and a processor. In the linux there are basically three types of system call are as follows: