- Форум
- По малко от всичко
- Тийн Учител - есета, теми, съчинения...
- Функции и низове..?
Гледам, че вече е написана, но ето все пак и от мен един вариант:
#include <iostream>
#include <string.h>
#include <stdio.h>
#include <conio.h>
using namespace std;
void Triene(char c[50], int in)
{
int i;
for(i=in; i<strlen(c)-1; i++)
{
c[i]=c[i+1];
}
}
void Chistene(char c[50])
{
int i;
for(i=0; i<strlen(c)-1; i++)
{
while (c[i]==' ' && c[i+1]==' ')
{
Triene(c, i+1);
}
}
}
int main()
{
char st[50];
int i, n, j;
cout<<"How many strings do you want to enter:";
cin>>n;
for (i=1; i<=n; i++)
{
cout<<"\n\nEnter the string "<<i<<":";
j=0;
do
{
//std::cin.ignore(std::numeric_limits<std::streamsiz e>::max(), '\n');
st[j]=getche();
j++;
}
while (st[j-1]!='\r');
st[j]='\0';
Chistene(st);
cout<<"\n\nThe new string is:\n";
cout<<st;
}
cout<<"\nPress enter to exit.\n";
std::cin.ignore(std::numeric_limits<std::streamsiz e>::max(), '\n');
std::cin.get();
}
Има 10 вида хора. Тези, които могат да четат двоичен код и тези, които не могат.