ADVERTISEMENT

One of the works done by our Robotics and Machine Learning division,
SELF-LEVELING QUADCOPTER
Arduino based Quadcopter.
Self-leveling is acheived by the aligning the quadcopter using the readings from the gryo as well as the accelerometer.
A four channel RC transmitter is used to control the movement of the quadcopter when in flight. Kindly subscribe to our YouTube Channel and stay tuned.

Thursday 28 April 2016

CSE1002:PP8:Number of words

PSUDOCODE:

START
READ s;
SET char d;
OPEN FILE "tweets.txt" in f
SET int c=0;
SET int count=0;
while(!f.eof())
f.get(d);
if(d==s[c])
c++;
else
c=0;
end if
if(c==strlen(s))
count++;
c=0;
end if
end while
print count
STOP

CODE:
 #include<fstream>
#include<iostream>
#include<string.h>
using namespace std;
int main()
{
fstream f;
char s[100];
cin>>s;
char d;
f.open("tweets.txt",ios::in);
int c=0;
int count=0;
while(!f.eof())
{
f.get(d);
if(d==s[c])
{
c++;
}
else
{c=0;}
if(c==strlen(s))
{
count++;
c=0;
}
}
cout<<count;



return 0;
}

No comments:

Post a Comment