home hardware prices news articles forums photos user reviews
Go Back   Tech Support Forums - TechIMO.com > PC Hardware and Tech > Webmastering and Programming
Ask a Tech Support Question (free)!

I need help to use asci codes

Reply
Get bargains at  »  Dealighted.com
 
Thread Tools Search this Thread
Currently Active Users: 2389
Discussions: 200,942, Posts: 2,379,318, Members: 246,305
Old March 25th, 2005, 11:11 AM   Digg it!   #1 (permalink)
Junior Member
 
Join Date: Mar 2005
Posts: 8
I need help to use asci codes

i have an assignment to write c++ program that should be very easy but i am very new to write codes in c++. My topic is that encryption of "sweidon" and i ll replace each letter with the three places later in the alphabet. For example, Instead of writing "A" , i ll write "D" .... I couldn't find out how can i write it in codes.

i think i should use ASCI and i should add 3 upon the ASCI code to reach the encryption code.... how should i write to read all letters that is inclued in family name of "sweidon" ????
Tayfun is offline   Reply With Quote
Old March 25th, 2005, 11:20 AM     #2 (permalink)
Real gangstas sip on Yacc
 
jkrohn's Avatar
 
Join Date: Oct 2001
Location: Suckas-ville
Posts: 4,552
Send a message via ICQ to jkrohn Send a message via AIM to jkrohn Send a message via Yahoo to jkrohn
Read them in as characters. Then cast to ints.

char blah = 's';
int code = (int)s;
code += 3;
blah = char(code);
jkrohn is offline   Reply With Quote
Old March 25th, 2005, 11:28 AM     #3 (permalink)
Junior Member
 
Join Date: Mar 2005
Posts: 8
so should i write for loop for other char, shouldn't i ? or i ll input the chr. one-by-one
Tayfun is offline   Reply With Quote
Old March 25th, 2005, 11:28 AM     #4 (permalink)
Real gangstas sip on Yacc
 
jkrohn's Avatar
 
Join Date: Oct 2001
Location: Suckas-ville
Posts: 4,552
Send a message via ICQ to jkrohn Send a message via AIM to jkrohn Send a message via Yahoo to jkrohn
you should take input as a character array and loop through it.
jkrohn is offline   Reply With Quote
Old March 25th, 2005, 11:31 AM     #5 (permalink)
Junior Member
 
Join Date: Mar 2005
Posts: 8
all right then, i ll try immediatly... thnx so much
Tayfun is offline   Reply With Quote
Old March 28th, 2005, 07:55 PM     #6 (permalink)
I am a banana!
 
originel's Avatar
 
Join Date: Jun 2002
Location: Texas Tech
Posts: 3,921
Send a message via AIM to originel
you don't even have to typecast because a char is an 8-bit int anyways.

to shift it three places you just add 3 to it...it's that simple
Code:
char letter = 'A';
letter += 3;
letter equals 'D' after this. A little side note about characters, the syntax 'A' is just another way of writing 0x41. It's like a placeholder really and is actually an integer, and so you can do any integer stuff with a char (with the exception of passing to functions and some more complex memory stuff since it's 8 bits, not 32 bits).
originel is offline   Reply With Quote
Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search

Similar Threads
Thread Thread Starter Forum Replies Last Post
Mafia Cheat Codes Question HansGroenewold General Gaming Discussion 33 August 5th, 2003 04:30 PM
Need Staples Coupon Codes Milan0007 ResellerRatings Homepage Deals 1 October 25th, 2002 06:21 PM
Promotional Codes? aznlurkerz ResellerRatings Homepage Deals 2 August 14th, 2002 01:11 AM
Has anyone ever seen coupon codes for www.dalco.com John Prophet ResellerRatings Homepage Deals 3 May 14th, 2002 06:41 PM
Staples coupon codes I_W ResellerRatings Homepage Deals 1 December 31st, 2001 07:56 PM


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Most Active Discussions
The disrespect of Obama by Russian .. (12)
Making Health Care Worse (153)
Is It Just Me? (2918)
Wireless Televisions. (11)
windows 7 problem (7)
CPU fan stops spinning randomly (8)
Regular Build (6)
Is the PSU I received dead? (11)
Print spooler problem (15)
HIS HD5770 graphic card question (15)
windows vista security holes (9)
Install XP pro and a Vista laptop ?.. (11)
Foreign voltage (10)
Dept. of HS: NSA 'Helped' Develop V.. (15)
Recent Discussions
Print spooler problem (15)
Laptop with wireless problem. (1)
Wireless Televisions. (11)
Have you switched yet? (86)
Asus P4G8X Mobo (5)
screen resolution vs monitor size (2)
radeon x850xt platinum & shader 3 (4)
sms storage to PC (0)
Regular Build (6)
Open With ..... Win7 (0)
java code for fibonacci (1)
[F@H SPAM 11/16/09] ! 1/2 months to r.. (35)
windows 7 problem (7)
CPU fan stops spinning randomly (8)
Partition Magic caused HDD problem (3)
Is the PSU I received dead? (11)
Point and Shoot Camera Suggestions. (2)
Modern Warfare 2 freeze (13)
wireless user (1)
World's largest Monopoly Game using G.. (332)
Ideal cheap graph card for PC-Gaming? (17)
BIOS won't read disk when I try to fl.. (0)
Install XP pro and a Vista laptop ?? (11)
Graphics Card Upgrade Question (1)
favorit (1)


All times are GMT -4. The time now is 05:01 PM.
TechIMO Copyright 2009 All Enthusiast, Inc.



1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28