-
May 6th, 2009, 02:16 PM
#1
Read string by words
I dont know how good you are going to undestand me:
I made an encryption program. It uses space between 2 letteres. Now I want to use the generated string and read every word at a time and convert it to a letter.
Here is the code:
// decript.cpp : Defines the entry point for the console application.
//
#include "stdafx.h"
#include <iostream>
#include <stdio.h>
#include <string>
#include <sstream>
#include <algorithm>
#include <iterator>
using namespace std;
int main() {
cout <<"Enter encripted text" <<endl;
char str[2];
cin >> str[1];
char line = str[1];
char pch;
pch = strtok (line," ");
while (pch != NULL)
{
printf ("%s\n",pch);
pch = strtok (NULL, " ");
}
system("PAUSE");
}
For some reason, I doesnt works.
Please help me!
Tags for this Thread
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|