hi

may I bother you a moment :icon_redface:

the follow program is without compilation error but whin I running , load error appear

can you help me what is the error :( :(

#include <iostream>

#include <string>
using namespace std;



 
bool function ()
{
  int ascii;
   string s1= "word" ;
  
  ascii= static_cast <int> ( s1.at(0) ); 
  
  if( (s1.at(0) >= 97 && s1.at(0) <= 122)|| (s1.at(0)>= 65 && s1.at(0) <= 90) )
  {
    s1.at(0) = static_cast <char> (ascii);
    int i=1;
    ascii= static_cast <int> ( s1.at(i) );
    while ( ( s1.at(i) >= 97 && s1.at(i) <= 122)|| ( s1.at(i) >= 65 && s1.at(i)<= 90) || ( s1.at(i) >= 48 && s1.at(i) <= 57) || ( s1.at(i) == 95) )
    {
      s1.at(i)= static_cast <char> (ascii);
      i++;
      ascii= static_cast <int> (s1.at(i));
    }
	if (s1.at(i) == 59)
        
         s1.at(i)= static_cast <char> (ascii);
        
    else
     {
		 cout << "error\n";
       s1.at(i) = static_cast <char> (ascii);
       return false;
     }

   
  }

  return true ;
}



int main()
{
	int n;
	 if ( function() )
        cout << "true";
	 cin >> n; 
	 return 0;
}

Recommended Answers

All 2 Replies

What is the error ??

Member Avatar for iamthwee

I think the real question should be what is that God-awful obfuscated mess?

commented: haha :P +3
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.