,   CyberForum.ru

- C++

C++ sin(x) http://www.cyberforum.ru/cpp-beginners/thread628046.html
! : #include <cmath> #include <iostream> #include <cstdlib> using namespace std; double my_abs(double val) { double ret = val;
C++ map , ! , "4". TExpiredNumberHandler true ( ): #include <iostream> #include <string> #include <map> #include <iterator> #include <utility> class TExpiredNumberHandler http://www.cyberforum.ru/cpp-beginners/thread628043.html
C++
!!! ? // main.cpp #include "parser.h" int main() { char prog_buff;
? C++
- ++, , ? , 1-2 , - . , 3 . 3 , ...
C++ resize http://www.cyberforum.ru/cpp-beginners/thread627897.html
n . vector::erase . .. , , vector::resize. : 1. , erase resize ? ? 2. resize ...
C++ . . . #include <iostream> using namespace std; class MyCl{ public: int mass; MyCl(); ~MyCl();

danwich
0 / 0 / 0
: 24.07.2012
: 4
24.07.2012, 15:35  []    
-==-

C++
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
#include <string>
#include <sstream>
#include <iostream>
using namespace std;
 
//Ôó*êöèÿ âîçâð*òèò ñëîâî ëèøü ñ 1-êð*ò*ûì âõîæäå*èåì áóêâ
char * getFirstAlphas(char * word);
 
int main()
{
    system("chcp 1251");//Ïðîñò*ÿ ðóññèôèê*öèÿ
    char text[1024] = {0};//Áóôôåð äëÿ ââîäèìîãî òåêñò*
    char word[32]   = {0};//Áóôôåð äëÿ ââîäèìîãî ñëîâ*
    stringstream ss;//Ñòðè*ãïîòîê (ò*êîé æå ïîòîê ââîä* ê*ê ifstream
    //òîëüê î÷åðï*åò î* ä***ûå *å èç ô*éë* * ñ **øåé ñòðîêè)
    cout<<"Ââåäèòå òåêñò :\n";
    cin.getline(text,1023);//Ââîäèì òåêñò ñ ïðîáåë*ìè
    ss.str(text);//Ç*ïèõèâ*åì **ø òåêñò â ïîòîê
    while(ss>>word)//×åðï*åì ïî ñëîâó èç ïîòîê*
        cout<<getFirstAlphas(word)<<" ";//è ïå÷*ò*åì óæå ïðåîáð*çîâ***ûå ñëîâ*
    cout<<endl;
    system("pause");//Ñòîï-òî÷ê*
    return 0;
}
 
char * getFirstAlphas(char * word)
{
    char * sub= NULL;//Óê*ç*òåëü ** ïîäñòðîêó 
    char symbol=0;
    for(int i = 0; word[i] != '\0'; i++)
    {
        //Èùåì 1-å âõîæäå*èå ñèìâîë* â ñëîâî
        sub = strchr(word, (symbol = word[i]));
        //Ïîèñê ïîñëåäóþùèõ âõîæäå*èé óê*ç***îãî ñèìâîë* â ñòðîêó
        while((sub = strchr(word + i + 1, symbol)))
        {
            //Åñëè ïîâîòð*ûå âõîæäå*èÿ åñòü
            //ïðîñòî âûòèð*åì èõ èç ñòðîêè 
 
            //Ïðîâåðÿåì *å áûë ëè ñèìâîë ïîñëåä*èì â ñòðîêå
            if(sub + 1)
                strcpy(&word[i], &word[i + 1]);
            else//Åñëè ñèìâîë âñ¸ æå áûë ïîñëåä*èì
            //îáðåç*åì ñòðîêó
                word[i] = '\0';
        }
    }
    return word;//Âîçâð*ù*åì ïðåîáð*çîâ***îå ñëîâî
}
, . ,
       
 
: 13:28. GMT +3.
- , ,
-
Powered by vBulletin® Version 3.8.9
Copyright ©2000 - 2016, vBulletin Solutions, Inc.
@Mail.ru