In general I'm most experienced with C++, next to a little Visual Basic.
for(int i = 0,array[i],i++){cout << array[i];}
#include "stdafx.h"
#include <iostream>
#include <cstring>
using namespace std;
int main()
{
char str[] = "ishpcm";
int left = 0; int right; char x;
for(left = 0; left <= strlen(str)-1; left++)
{
for(right = strlen(str)-1; right > left; right--)
{
if(str[right] <= str[left])
{
char x = str[left];
str[left] = str[right];
str[right] = x;
}
}
}
cout << str << "\n";
}
char *search= new char[]; // or use a pointer to a new array of unknown size.
char yn[100]; // Store the yes\no answer in a character array.
Cyclone wrote:Thanks, I kinda figured the unsized array was the problem. I did try the sized array which if you noticed was commented out. What prevented the sized array from working was the function gets() . To fix I used getline() instead.
Is there any reason in particular you specified the size of the array using a hex value?
Users browsing this forum: No registered users and 9 guests