Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- using namespace std;
- int zoma(char* string)
- { int counter=0;
- for (int i=0;string[i]!='\0';i++)
- {
- counter++;
- }
- return counter;
- }
- char* shecvla(char*string,char symbol,int pozicia)
- {
- int size =zoma(string);
- pozicia--;
- cout <<" size "<< size <<endl;
- if (pozicia>=0 && pozicia<=size)
- {
- string[pozicia]=symbol;
- return string;
- }
- else
- { string="error out of range";
- return string;
- }
- }
- int main()
- {
- int pozicia;
- char string[100];
- char symbol;
- cout<<"sheyvane stringi:";
- cin>>string;
- cout <<" sheyvane symbolo: " ;
- cin>>symbol;
- cout<<"sheyvane pozicia chanacvlebis : ";
- cin>>pozicia;
- char * changed=shecvla(string,symbol,pozicia);
- cout<<changed;
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement