I have couple of text files with some drawn shapes made of . and +
for example:
I am reading this text file info an 2D array.
Looking at the example I see 4 shapes made of +
But how how can...
Type: Posts; User: Tupcia
I have couple of text files with some drawn shapes made of . and +
for example:
I am reading this text file info an 2D array.
Looking at the example I see 4 shapes made of +
But how how can...
Swoopy:
That is not the actual program, but a quick sample showing the problem, I typed it fast here, and I forgot to place "<<"
anyway here is my actual program, now I am passing the vector by...
#include <cstdlib>
#include <iostream>
#include <vector>
using namespace std;
void print(vector <int> *xxx);
int main(){
vector <int> xxx;
I am trying to get time complexity ( Big O of N)
For heap sort it should be O(N*log(N))
Now I realized that the title of the thread is somewhat missleading
I am trying to see how many steps it will take to sort a set of ints via heap sort.
// x = how many random ints were generated
int z = 0;
for(int k=x;k>0;k–-){
for(int i=1;i<=k;i++){
...
How can I convert an array of 25 elements into a 5x5 2D array?
int x, y,z;
char arr[5][5];
for ( x = 0; x < 5; x++){
for ( y = 0; y < 5; y++){
z=read(pipe, buf, PIPE_BUF);
arr[x][y] = z;
printf("%c%c", arr[x][y]);
}
printf("\n");
This gets char array sent via pipe to a second process and prints it:
int x;
int pipe;
char buf[PIPE_BUF];
while ((x=read(pipe, buf, PIPE_BUF))>0)
write(fileno(stdout), buf, x);
Got it, by breaking the string into tokens:
vector <string> text;
char input = "a.ds.ees.f.csg.cw.s.ab.s.f.s.ffsd.j" ;
char *a;
a = strtok(input, ".");
vector <string> text;
string input = "a.ds.ees.f.csg.cw.s.ab.s.f.s.ffsd.j" ;
int j = 0;
for (int i=0;i < input.length(); i++){
if(isalpha(input[i]))
...
but when I do that it places every char into a seperate element, and I want to group them
insted of [a][d][s][e][e] ... I want [a][ds][ees] ...
Thanks for the idea.
Now what is wrong with program it crashes;
vector <string> text;
string input = "a.ds.ees.f.csg.cw.s.ab.s.f.s.ffsd.j" ;
I have a string of letters seperated by periods, like this:
I want to place each set of letters into a element of an array, so it would look something like:
Can you guys give me an idea on how...
I am having trouble concatenating 2 chars
char a = 'a';
char b = 'b';
strcat (a,b);
cout << a;
what is the proper way of doing something like this?
Cool BIG thanks for the help!
How can I do this?
Or could someone please point me to a good tutorial.
Thanks
How can I declare a global array whose size I calculate in a function later on (based on # of rows & columns of terminal ).
// global vars
int row, col;
char box[row][col]; // causes error...
I am having trouble returning a file descriptor to main and calling a 2nd function there passing the returned file descriptor as paramater.
FILE *file_des;
FILE x;
FILE input(char* title){...
cool, so I can place any number as the second dimension ?
I am having trouble passing an 2d array to a function:
int sum (char ar[][], int i, int j){ // line 20
int x=0;
if (ar[i][j] == 'a')
x++;
if (ar[i][j] == 'b')
x+=2;
if...
// fill
for (int i=0; i<10;i++)
for (int j=0; j<10;j++)
square[i][j]= '0';
// update
square[1][1]= '4';
square[3][4]= '1';
square[7][7]= '7';
I am having problems with erasing a letter, what is wrong?
struct termios input;
input.c_flag &= ~ISIG;
input.c_flag &= ~ICANON;
FILE *point;
tcsetattr(fileno(point),TCSANOW,&input);