Code Newbie
News     Forums     Search     Members     Sign Up    

My Code Newbie
Username

Password

Articles/Snippets
ASP Classic
ASP.NET
C
C#
C++
HTML / CSS
Java
Javascript
Linux / BSD
Perl
PHP
Python
Ruby
SQL
VB 6
VB.NET

C.N. Friends
  Planet Rome

Link to Us!
Code Newbie
  Code Newbie
    forums
Old 10-24-2004, 08:33 PM   #1 (permalink)
somnath
Registered User
 
Join Date: Oct 2004
Posts: 4
somnath is on a distinguished road
help with program

Write a complete program that creates an array of characters, 3 times
the size of ASCII table and itinializes the contents of the array to
correcponding ACSII values; when end of ACSII table is reached, you
should loop back to the beggining and start again.

Print the contents of the array, seporating the copies of ACSII table by
2 blank lines.


Note:
- You must utilize for loop structure.
- You may not combine assigment and printing out in one phaze, those
two must be seporate distinct stages.


Tips:
- use % as part of your for-loops to help you loop through the legal
range of an ACSII table



and here i came up with....dont know what to do next

#include <iostream>
using namespace std;
using std::endl;
int main (void)
{

cout<<"ASCII Table"endl;
int i;
char array = 256*3;
int arr [array];

for(int i=0; i<(array); i++)
arr[i] = i%256;
}
OUTPUT should be like this...
!@#$%... 12345... abcdefgh... ABCDBEFGH...

!@#$%... 12345... abcdefgh... ABCDBEFGH...

!@#$%... 12345... abcdefgh... ABCDBEFGH...

Help would greatly appreciated!
somnath is offline   Reply With Quote
Old 10-25-2004, 01:04 AM   #2 (permalink)
redhead
Newbie
 
redhead's Avatar
 
Join Date: Jun 2002
Location: Denmark
Posts: 1,713
redhead is on a distinguished road
are you looking for something like this:
Code:
#include <iostream>
using namespace std;

int main (void)
{
  cout << "ASCII Table times 3" << endl;
  int i,n;
  const int array = 256*3;
  char arr[array];

  for(i=0; i<array; i++)
   arr[i] = i%256;
  for(n=0; n<3; n++)
  {
    for(i=0; i<256; i++)
     cout << (char) arr[i];
    cout << endl << endl;
  }
  return 0;
}
__________________
Don't worry Ma'am, We're university students, We know what We're doing.
-----
If you pull the pin, Mr.Grenade would no longer be your friend.
-----
01000111 01101111 00100000 01000011 00100000 00100001
redhead is offline   Reply With Quote
Old 10-25-2004, 03:35 AM   #3 (permalink)
somnath
Registered User
 
Join Date: Oct 2004
Posts: 4
somnath is on a distinguished road
Quote:
Originally posted by redhead
are you looking for something like this:
yeah...kind of. But thanks very much for help. I got idea from your program. thanks again.
somnath is offline   Reply With Quote
Reply

Bookmarks

Thread Tools
Display Modes

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

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
C++ Deadlock Detection Program Help... coolsc81 Standard C, C++ 2 10-26-2004 06:14 AM
Help on starting new program B00tleg Standard C, C++ 21 10-17-2004 12:58 PM
Need help on program B00tleg Standard C, C++ 1 10-12-2004 12:02 AM
Help on interest program B00tleg Standard C, C++ 2 10-07-2004 08:50 PM


All times are GMT -8. The time now is 06:35 PM.


Powered by vBulletin® Version 3.7.0
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.0.0 RC8





Copyright © 2000-2008, Milano Interactive
Web Hosting provided by Portal 360 Web Hosting