Forum: C++ May 5th, 2008 |
| Replies: 12 Views: 892 char ch = '—';
cout << static_cast<int>(ch);
The output is -105.
I tried isprint(), but it still gives an error. |
Forum: C++ May 4th, 2008 |
| Replies: 12 Views: 892 Is there a way to check if we've got one of the extended ASCII codes in C++? Because, I am reading from a file that contains '—', and because of that I get a "Debug assertion failed: (unsigned)(c+1)... |
Forum: C++ May 4th, 2008 |
| Replies: 12 Views: 892 thanks a lot man. it works now.
Just one more thing,
What are the not printable characters for C++?
One that I found is —. That is not minus(-). |
Forum: C++ May 4th, 2008 |
| Replies: 12 Views: 892 I haven't used vector before, but that looks easy using vectors. How would I compare say, "Alkesh" in the vector "theList". |
Forum: C++ May 4th, 2008 |
| Replies: 12 Views: 892 Ok. What I meant by getting the string twice is that, I am getting all the words 1st time just to know how many words are there. Then, 2nd time I am doing same thing but now I am actually storing... |
Forum: C++ May 4th, 2008 |
| Replies: 12 Views: 892 Hey Guys,
I want to read from a file. And store the string in a string class array. Number of strings in the file is unknown. How could this be done?
int n=0;
while(!inFile2.eof())
{... |
Forum: C++ May 2nd, 2008 |
| Replies: 3 Views: 1,762 ok, line count should work. But, words in our program aren't supposed to include non alphabetic characters. How would I go about that? |
Forum: C++ May 2nd, 2008 |
| Replies: 3 Views: 1,762 Hey Guys,
So, I am writing a program that reads in from a file, and prints the word and counts the number of lines in the document. Here is the function that is supposed to do the work. Every time I... |
Forum: C++ Apr 1st, 2008 |
| Replies: 10 Views: 915 yes, [0,100].
So, could I just modify it like the following?
std::random_shuffle ( a, a + 101 ); |
Forum: C++ Apr 1st, 2008 |
| Replies: 10 Views: 915 so, how would I go about modify random shuffle code that you wrote, for 5 random numbers and range [0,100]? |
Forum: C++ Apr 1st, 2008 |
| Replies: 10 Views: 915 would that work for larger range, if change n to 100? My goal is to create 5 random numbers from 1 to 100 without repetition. |
Forum: C++ Apr 1st, 2008 |
| Replies: 10 Views: 915 I ask because it works alright for larger range, but If I change the range to 0 to 4 instead of 0 to 20. I do get repetition. Is it possible to modify it a bit to get 100% no repetition? |
Forum: C++ Apr 1st, 2008 |
| Replies: 10 Views: 915 hey guys,
I want to create 6 different random numbers without repetitions and this what I have done. I just wanted to make sure if this logic makes sense.
for(int n=0 ; n<6 ; n++)
{... |
Forum: C++ Mar 20th, 2008 |
| Replies: 6 Views: 548 thanks man. It works now. Could you check if it everything is okay?
You see any places for improvement?
void profile::createProfile()
{
ProfileType *newProfile;
ProfileType *profilePtr;... |
Forum: C++ Mar 19th, 2008 |
| Replies: 6 Views: 548 yep, i had head == NULL instead of head = NULL.
thanks.
now, can i put the following code into another function say generateRandomProfile()?
newProfile->countryOfOrigin =... |
Forum: C++ Mar 19th, 2008 |
| Replies: 6 Views: 548 thanks man, got it working but now a new problem.
int profile::randomNumGenerator(int min, int max)
{
int random_integer;
int range=(max-min)+1;
random_integer =... |
Forum: C++ Mar 19th, 2008 |
| Replies: 6 Views: 548 why is this keep giving me same 2 numbers?
#include <iostream>
#include <iomanip>
#include <ctime>
#include <cstdlib>
#include <windows.h>
using namespace std;
int generate(int,int); |