GIDForums  

Go Back   GIDForums > Computer Programming Forums > C++ Forum
User Name
Password
Register FAQ Members List Calendar Search Today's Posts Mark Forums Read

 
 
Thread Tools Search this Thread Rate Thread
  #1  
Old 05-Dec-2008, 23:09
Gamerz Gamerz is offline
New Member
 
Join Date: Dec 2008
Posts: 2
Gamerz is on a distinguished road

String Editing Error (fixed)


CPP / C++ / C Code:
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <string.h>

using namespace std;

//creates a slight delay in drawing each character
void sleep(int sleep_time){
	for(sleep_time;sleep_time == 0;sleep_time--){}}
	
	
void draw_text_char(string str_text){
	//string used to hold the next character to be drawn
	string current_text[strlen(str_text)];
	
	//the overall length of the string to be drawn. Used so the for statement stops at the end of
	//the string.
	int string_length = strlen(str_text);
	
	//the current character value being drawn. This extends the string to be drawn to one more
	//character.
	int current_char = 0;
	
	//this is used to draw the text.
	for(current_char; current_char == string_length; current_char++){
		//clears the screen
		system("cls");
		
		//copies the string to be drawn up to the point designated by current_char.
		//current_char is also used to designate the index in which the new string will be drawn.
		strncopy(current_text[current_char],str_text,current_char);
		
		//draws the new string
		cout << current_text[current_char];
		
		//give a small wait time
		sleep(20);
		}}
		
int main(){
	draw_text_char("0001010010010001001001010010010");}

This is to create a function that draws a string one character at a time. I am currently using Dev-C++ (4.9.8.0) IDE, and it's returning an error with the string editing functions, and the array. I'm not quite sure what I'm doing wrong, but since I made the error I guess I wouldn't see it. Can anyone tell me what's wrong with this script?
Last edited by admin : 06-Dec-2008 at 01:54. Reason: Please insert your C code between [cpp] & [/cpp] tags
  #2  
Old 05-Dec-2008, 23:12
Gamerz Gamerz is offline
New Member
 
Join Date: Dec 2008
Posts: 2
Gamerz is on a distinguished road

String Editing Error (FIXED)


Found the error, sorry. Nevermind.
 
 

Recent GIDBlogProgramming ebook direct download available by crystalattice

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Two-Tier data dissemination code installation problem nidhibansal1984 Computer Software Forum - Linux 6 16-Sep-2007 11:13
Linked Lists advice request promsan C Programming Language 74 23-May-2007 09:29
Major newbie problem cynack MS Visual C++ / MFC Forum 1 08-Apr-2007 12:25
Winsock error when compiling FLTK 2.0 Projects mauriciorossi FLTK Forum 3 16-Aug-2005 11:18
Help with syntax errors PeteGallo C Programming Language 7 08-Aug-2005 21:30

Network Sites: GIDNetwork · GIDWebHosts · GIDSearch · Learning Journal by J de Silva, The

All times are GMT -6. The time now is 19:54.


vBulletin, Copyright © 2000 - 2009, Jelsoft Enterprises Ltd.