Hi everyone, I'm new to programming (and daniweb) and I'm having a small problem with a Caeser Cipher program I'm writing. messageE = input('\nPlease enter string to encrypt: ') offsetE = int(input('Please enter offset value (1 to 94): ')) encryptedE = '' if offsetE < 1 or offsetE > 94: print('Incorrect input. Please enter a value between 1 and 94.') messageE = input('\nPlease enter string to encrypt: ') offsetE = int(input('Please enter offset value (1 to 94): ')) for char in messageE: encryptedE = encryptedE + chr(ord(char) + offsetE) print('Encrypted string:\n', encryptedE) Gives the output: Please enter string to encrypt: …

Member Avatar
Member Avatar
+0 forum 4

@echo off REM This batch file will play with shift command :loop echo %1 shift if %2 == GOTO end goto loop :end exit 0 When I inputted C:\Users\~\Desktop> Shift.bat 1 2 3 I got this 1 2 end was unexpected at this time. Why do I keep getting "end was unexpected at this time.

Member Avatar
Member Avatar
+0 forum 4

Hi everyone, I'm trying to figure out if there is any way to do exponents using bit shifting. I know the following: x *= 2 --> x << 2 x /= 2 --> x >> 2 pow(2, x) --> 1 << x i'm looking for the equivalent bitshift, if any, for x = pow(x, 2) where x can be any number i've seen the following for x = 5 x = 0101 (5) x << 2 --> 010100 (20) x + 0101 --> 011001 (25) but then that is not true for other numbers :(

Member Avatar
Member Avatar
+0 forum 1

I believe that one of the pages of the site that I'm creating is shifted slihtly to the left. I may be going crazy, but I'm pretty sure that's what's happening. The page that I believe is shifted is: http://armyants.us/members.php?steam=All If you guys could help me out here, then that's be pretty awesome. Thank you for your time!

Member Avatar
Member Avatar
+0 forum 3

I have an ASP Classic page with SHIFT_JIS charset. It has a meta tag under the <head> section like this: <meta http-equiv="Content-Type" content="text/html; charset=shift_jis"> My page has a text box (txtName) that should only allow 200 characters. I have a Javascript function that validates the character length, which is called on the onclick() event of my Submit button. if(document.frmPage.txtName.value.length > 200) { alert("You have exceeded the maximum length of 200."); return false; } The problem is, Javascript is not getting the correct length of Japanese character encoded in SHIFT_JIS. For example, the character **测** has a SHIFT_JIS length of 8 …

Member Avatar
Member Avatar
+0 forum 1

The language i'm trying to do this in is c++ let's say i have a number 123456 , i want to divide this up into partitions of two so i would have: 12,34,and 56. I want to add the partitions up and it would equal 102. How can this be done in c++? Thanks for the feed back :D:D

Member Avatar
Member Avatar
+0 forum 3

**Please help me friends** **I have a doubt in using array in JAVA** **if my input is AB1CD** They are stored in array as a[0]=A a[1]=B a[2]=1 a[3]=C a[4]=D I developed a coding to insert the number that appearing after a alphabet in the same array element like a[0]=A a[1]=B1 a[2]=C a[3]=C a[4]=D The program is given below import java.io.*; class suba { public static void main(String args[]) throws IOException { String[] st= new String[100]; System.out.println("Enter the text :"); BufferedReader br=new BufferedReader(new InputStreamReader(System.in)); String str=br.readLine(); st=str.split(""); for(int k=0;k<(st.length-1);k++) { st[k]=st[k+1]; } //char ch[]=str.toCharArray(); for(int i=0;i<st.length-1;i++) { if((st[i].equals("0"))||(st[i].equals("1"))||(st[i].equals("2"))||(st[i].equals("3"))||(st[i].equals("4"))||(st[i].equals("5"))||(st[i].equals("6"))||(st[i].equals("7"))||(st[i].equals("8") )||(st[i].equals("9") ) ) …

Member Avatar
Member Avatar
+0 forum 4

Hi All, I am trying to understand shift operator which is used in my project. What I came to know from google is that Bit shifting allows for compact storage of similar data as a single integral value. But how does that work. and what is the advantage. Can you explain me the part below program whats exactly happening in below lines. The code is taken from [url]http://www.codeproject.com/KB/graphics/dicomImageViewer.aspx[/url] (Tnx to Amarnath S) int vr = (b0 << 8) + b1; and case UT: ?? This programe reads a binary file, in medical terms a dicom file, which is basically a …

Member Avatar
Member Avatar
+0 forum 1

There was question about encryption in Delphi/Pascal forum and a guy was suggested reversing the bits as additional step (I do not know if he in reality meant XOR 255, that is making 0's 1's and vice versa). As it keeps still same distribution of letters I suggested as better added scrambling to shift letters as whole right. Shifting bits across byte boundary was interesting code, so I presented pseudo code and here is the implementation part. I added parameter for number of bits in letter, so this could be applicable for uni code also as the ord function works …

Member Avatar
+0 forum 0

Okay the text on my input file is Wxmv_bpm_xwl_jig_lwwza,_PIT._Q'u_awzzg,_Lidm._Q'u_inziql_Q_kiv'b_lw_bpib. Here's My code but for some reason I can't get my program to convert the message to my output.txt file. Can someone please help thanks [CODE] #include <iostream> #include <fstream> #include <cstdlib> using namespace std; int main() { string str; int shift; char inChar; char outChar; char c; ifstream inputFile("INPUT.txt");// Opening INPUT.txt file ofstream outputFile("OUTPUT.txt");// Opening OUTPUT.txt file if(!inputFile){// Checking for errors or existence of INPUT.txt file cout << "Error...file INPUT.txt doesnt exist.\n"; exit(1); } if(!outputFile){// Checking for errors or existence of OUTPUT.txt file cout << "Error...file OUTPUT.txt doesnt exist.\n"; exit(1); …

Member Avatar
Member Avatar
+0 forum 9

I have read many different threads about how it is not possible to delete values from an array, but I need to find some way to do this. I am making a program that involves a bottom up approach algorithm where it pairs off data segments, finds the best segments to merge and then merges them. I have it telling me which segments it should merge but then to merge them I need to be able to go in a remove certain values from that array. I can find them by the index or actual value I suppose. ex [CODE] …

Member Avatar
Member Avatar
+0 forum 10

I have a byte array which looks something like 01 00 02 00 73 45 69 A5 So i have to read first 2 bytes and convert it into integer to get its value. Same for next 2 bytes and then next 4 bytes. Here the value for first 2 bytes (01 00) is 1, next 2 bytes (02 00) is 2. So could some one help me on this.

Member Avatar
Member Avatar
+0 forum 4

Hello, I'm a new user, but a long time reader (sounds like I'm on a radio show lol) and I just have a question regarding the "page shift problem". For those of you who are not familiar with what the page shift is, it's basically only happens with "centered" templates. It's when your page is shifted to the left just a couple of pixels because of the vertical scrollbar that is added when there is a lot of content on the page. When there's not a lot of content (and the vertical scrollbar is not needed) then the page looks …

Member Avatar
Member Avatar
+0 forum 2

Hi everyone - This is my first post, so please be gentle :) I am having a problem on a website I recently built in which the entire container is shifting just a few pixels to the right on some of the pages of the sites. Not all of the pages, but some. On the pages, there are two left-floated divs (total of widths/margins/paddings do not exceed container width). In comparing the pages, the only thing that appears to be different (aside from the text) is that the left floated div on the page is shorter than the right floated …

Member Avatar
Member Avatar
+0 forum 6

Hello I am having trouble with my spry drop down menu shifting to the right when I hover over the navigation bar. It is only the submenu's that shift, not the actually nav bar itself. The error is only visible in IE6 & IE7. I do not see the problem at all on Firefox (windows/mac), Safari (windows/mac) or IE8. [I][COLOR="Red"]Note: This is the dreamweaver spry drop down menu.[/COLOR][/I] If someone can help, that will be greatly appreciated. Here's the site: [url]http://eagleridge.blueicegraphix.com[/url] Hopefully its not a javascript issue, as I am not too familiar with the language. CSS Code: [CODE]@charset "UTF-8"; …

Member Avatar
+0 forum 0

Is there a way to determine which shift key is pressed? I am writing a program that shows an image and I want the user to say which side of the screen it is showing up on.... I thought of using the mousekeys but realized that not all computers have mousekeys. Is there a way to determine it is the left shift key or the right shift key?

Member Avatar
Member Avatar
+0 forum 10

I have a simple web page. For some reason, one of my div's (holding a bing map), is shifted way off in the blue. Here is the link: [url]http://70.38.38.174//where-does-this-drain-to/where-does-this-drain-go.html[/url] Looks fine in Chrome/IE. Thanks in advance, M

Member Avatar
Member Avatar
+0 forum 4

The End.