Work in progress...
using namespace std;
bool defmundo(int size);
bool defen(int energia);
Type: Posts; User: thinkabout
Work in progress...
using namespace std;
bool defmundo(int size);
bool defen(int energia);
I want to treat the sentence now, i need to extract the next values...
Example: defmundo 5 2 hard (int int string)
Example: defxpto hard 2 ( string int)
Example: defasta hada ( string)
...
Hi,
I got this coding working but i want to improve it.
I want to make sure that the frist word i read is a string without numbers.
Then i want to make sure the second / third word...
I wish the work of that picture was mine.
I donīt have a clue how i should do the board and put colors on my numbers.
Map::Map(int size) {
if (size < 10) {
cout << "size to small, need to be at least 10x10" << endl;
return;
//TODO output to console
}
cout << "size is ok, going to create it" <<...
Hi everyone,
I am trying to do a map so i can build a game.
My ideia was to use a vector of vector.
I want to make a function to print the map but i donīt know how, i am just able to print...
Hi,
The part of the Palindrome is working but i want to my program to print "Press ENTER to continue" in the end of each cycle.
It is working but i donīt think that is the best way.
//...
Thanks you both for your answers
I found this video that i find useful too.
YouTube
Hi, can anyone explain me when should i use pointers and when i should use reference ?
void exchange(int * pa, int * pb) {
int temp = *pa;
*pa = *pb;
*pb = temp;
cout <<...
Hi,
I am going to start to give C++ at university.
Anyone recommend a good youtube channel for that ?
I got two more functions but i am a little lost where i should use free function.
Function 1 - Take care of the first client on the list.
node * see_patient(node * list) {
node *...
So far i got new patient and show_queue (working).
I got a little doubt
When i make malloc should i put the patient i just create to NULL or that donīt matter ?
// 1š Get Memory from...
Finally working... Thanks a million.
Still going to need to read about strtol when i got some time.
I still didn't yet grasp the concept of it the endptr parameter.
strtol - C++ Reference.
It was on the first post, but yeah the thread is already a little old and long, so easily miss.
Text File:
DIM: 4
Linha0: 12 4 60 60
Linha1: 3 7 3 5
Linha2: -56 31 31 12
Linha3: 34 -33 2 4
Working but what a mess...
while (fgets(buffer, sizeof (buffer), pFile)) {
char *p = buffer;
while (*p) {
if (isdigit(*p) && (*(p + 1)) !=...
Maybe i am missing something i donīt full understand that function.
But if my text file is
DIM: 1
12 4 60 60
Works nice but if it have a string before the numbers does not work correctly....
I am try to transform the program into a generic one, so the matrix could be DIM 2 or DIM 10 for example.
But i am not see what function should i use.
I was trying with sscanf but with start...
I see, i dinīt know how to pass the strings, and no one teach me about size_t.
I know i can use int bufsize, but i think the correct way is to use size_t (for sure a positive value).
Why size_t...
Yes i was messing with || and &&
for (int j = 0; j < KEY_SIZE || flag == 0; j++)
it works
I donīt understand why my program fail, when i try to jump out of a loop using a flag.
int flag = 0;
for (int i = 0; i < KEY_SIZE; i++) {
for (int j = 0; j <...
Now i got other problem if the user forget to press enter on the last line, it counts 3 lines and not 4.
int count_lines(FILE * pFile, int nrlines_of_the_file) {
char buffer[SIZE];
...
#include <stdio.h>
#include <stdlib.h>
#define SIZE 100
int count_lines(FILE * pFile, int nrlines_of_the_file);
int main(int argc, char** argv) {
FILE * pFile;
// rename - 0 on sucess , -1 on error.
if (rename(argv[1], "temp.txt") == -1)
return -1;
if (rename(argv[2], argv[1]) == -1)
return -1;
if (rename("temp.txt",...
if (argc != 3) {
printf("\n- Invalid Sintax: %s Origin(file) Destination(file)\n- Ex: %s CodeA.txt CodeB.Txt\n\n", argv[0], argv[0]);
return -1;
}
rename(argv[1],...
I am study for a exam and i failed on little things so i am posting a lot of that ones.
I think that if you want to "build a house" you should get good bricks and sometimes even the things are...