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!

Recommended Answers

All 2 Replies

How about single quotes for characters ( '?' , '.' , '!' )?

Ah, I fig'd it would be something simple like that. Thanks =)

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.