0

Hi everyone. I'm new, but I'll be here for a while I think :cheesy: . Here is my code so far. The delays are because I wanted to simulate typing =).

//
#include <cstdio>
#include <cstdlib>
#include <iostream>
using namespace std;
int main(int nNumberofArgs, char* pszArgs[])
{
   int i = 0;
   string text = "This is where I would insert my text! lkjsdfa? alkdjfad.";
   for(int j=0;j<text.length();)
   {
      cout << text[j++];
      if((text[j-1]=="!")||(text[j-1]=="?")||(text[j-1]=="."))
      {
      i=clock();
      while(clock() < i+1000){}
      }
      i=clock();
      while(clock() < i+100){}
   }
 
}

Now, when I try to compile, I get an error "ISO C++", and it highlights the line

if((text[j-1]=="!")||(text[j-1]=="?")||(text[j-1]=="."))

which tells me absolutely nothing other than "WRONG". =). I have also tried

if((text[j-1]==!)||(text[j-1]==?)||(text[j-1]==.))

and

if((text[j-1]=="\!")||(text[j-1]=="\?")||(text[j-1]=="\."))

and

if((text[j-1]==\!)||(text[j-1]==\!)||(text[j-1]==\!))

. It doesn't even like

if(text[j-1]=="!")

or any permuation of "" and \. I can't even get

if(text[j-1]=="a")

to work, again with all permutations of "" and \.
Can someone please help me? Thanks!

2
Contributors
2
Replies
3
Views
10 Years
Discussion Span
Last Post by CStallion
This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.