Need help with getting my program to work.

Pages: 12
i use this way because to me its easy, it allows me to easier read the code and find bugs (despite how you say its harder), and I'm using everything I've created as something to look back at in the future.

If you would like to see all of the coding projects i have ever created (there all organized in a .zip file) you can email me and i will send them to you to look at
email: bigbrother328@cox.net
Last edited on
Oh, so you have never named your function "distance" or "max" or "generate" with use of <algorithm> header? Or work with library with several namespaces including global? It usually teaches to not have "using namespace" in global scope. Actually all corporation I worked on forbid use of using namespace in global scope. And explicitly forbid using namespace std everywhere.
Another link: http://www.parashift.com/c++-faq/using-namespace-std.html
Last edited on
I have never used <algorithm> header,
if you want to see all of my projects email me.

I am only 17, i am not planning on making console based games, (planning on online games) but use c++ as it is basis for many other languages (know many other languages as well), I know how to code without namespace std but since its not a priority, its easier for me to read code, or look back on in the future, so i use it.
Last edited on
So you have never used C++. You have used "C with classes". Main part of C++ is standard library, which allows you to not reinwent the wheel and to use optimized algorithms and containers which will work faster that you probably could write.

I suggest to read some C++ books. I recommend "C++ Coding Standards", or Scott Meyers books: Effective C++, More Effective C++, Effective STL and Overview of the New C++ (C++11)
Note that all of this books recommendation should be used with understanding that they were written before C++ 11 which made several technique obsolete.
Also this:
http://stackoverflow.com/questions/388242/the-definitive-c-book-guide-and-list
I have never even learned c, i started with c++, and just because i dont use #include <algorithm> ,does not mean i don't know c++, this is c++ as far as i know, as you would see from other projects, and i do code most c++ standards.

these are the only headers i have ever needed to use
1
2
3
4
5
6
7
8
9
#include <iostream>
#include <string>
#include <sstream>
#include <cstdlib>
#include <vector>
#include <fstream>
#include <windows.h>
#include <ctime>
#include <iomanip> 
and btw i created this program a week ago, so its not fully developed
Last edited on
Beginner level questions when hiring C++ developer:
What is pros and cons of std::unordered_set in comparsion with std::set?
Which standard algorithms does std::list implements as a member functions and why?
When you should use decltype instead of auto?
Which code is valid, which is not C++ standard compliant and which lead to undefined behavior:
1
2
3
4
5
6
7
8
    int x = 5//1
    int y(10)//2
    int array[2][2][2][2] = {};//3
    int z[y]//4
    x  = y  = x  = y; //5
    x ^= y ^= x ^= y; //6
    ++x *= y++; //7
    1[0[array][1]][0] = 1;//8 

That is a beginner level, which means that applicant knows basic C++ and will be code monkey in company. Waiting for answers!
Last edited on
Which code is valid, which is not C++ standard compliant and which lead to undefined behavior:
int x = 5//Which code is valid
1[0[array][1]][0]//which is not C++ standard compliant
int array[2][2][2][2] = {};//which lead to undefined behavior
Last edited on
You got it wrong :)
undefined behavior: 6;
Non-standard: 4 (if y was const, it would be standard)
All others are valid per C++ standard (Even 8)
Last edited on
cool and, your point, I havent coded in 6 months and never will I use

int array[2][2][2][2] = {};//4 dimensional array, uneeded
x = y = x = y; //extra coding
x ^= y ^= x ^= y;//no point
++x *= y++;//no point
1[0[array][1]][0] = 1;//makes no sense

Beginner level questions when hiring C++ developer
not planning on developing in c++, as it is not compatable easily with online games. just learning
Last edited on
if you want to look at all my c++ projects and tell me what I'm doing wrong. go ahead and feel free, i will gladly take note so i know not to make those same errors in the future
email: bigbrother328@cox.net
Last edited on
x ^= y ^= x ^= y;It is one-line fast xor swap implementation.
Usually and correctly written as
1
2
3
x ^= y;
y ^= x;
x ^= y;

++x *= y++ if it was *(++x) *= *(y++);it would be correct low-level pointers (or iterators) range manipulation.
x = y = x = y; If used as a += b = getValue(); it is fall-throug assigment. Used sometimes in complex algorithms.
int z[y] Valarrays. Will be included in C++14
Note that all these examples is synthetic and exist only to fix attention on some parts of the language.
Last one was to see if appicant knows that subscript operator is commutative, so a[2] is equivalent to 2[a].
4 dimensional array, uneeded
Main point that it is zero-initializated array.

All question designed to start discussion with applicant and test his level of knowledge.
For example answers "you can't do that", "standard explicitly forbids it" and "it would cause unneeded complexity in implementation because..." will each give you different position and salary.
By the way: why x ^= y ^= x ^= y; causes undefined behavior? Predict possible values of x and y after execution.
Last edited on
it is not compatable easily with online games
What? World of Warcraft written in C++, Lineage II based on UE which written in C++, Diablo 3 written in C++, most Ultima online servers written in C++.
As lower level languages C/C++ is often used for highload application like online games.
Last edited on
Bro you needa change from dev-cpp. Once you try something else you will never switch back.

Believe me, MiiNiPaa is right.

Why dont you just post a link to your programs here?

The STL is a huge part of C++, if you dont know much of it, I can safely say you dont know C++, at least fully.
Last edited on
> Bro you needa change from dev-cpp

Not really. If you are familiar with, and feel quite comfortable with a particular IDE, just continue using it.

But switch from the old compiler/IDE to a more recent one. For instance, Orwell Dev-C++
http://sourceforge.net/projects/orwelldevcpp/
@JLBorges

I meant switch from the old one to something more modern xD

Orwell could be a viable option
Last edited on
ill change my compiler soon,

Why dont you just post a link to your programs here?
since i can not put files on this website I'll put them in a facebook group and paste the link here.

https://www.facebook.com/groups/343876739068863/
Last edited on
Maps doesnt compile because you didn't give me the MapFunctions.h.

Lottery compiles but its not very difficult to make.

Here is the error for Fighting Game:

1>------ Build started: Project: Tests, Configuration: Debug Win32 ------
1>  player.cpp
1>  moves.cpp
1>  monster.cpp
1>c:\users\anmol\desktop\game files\fightinggame\monster.cpp(178): warning C4244: 'argument' : conversion from 'time_t' to 'unsigned int', possible loss of data
1>  clearscreen.cpp
1>  Battle.cpp
1>  Generating Code...
1>c:\users\anmol\desktop\game files\fightinggame\monster.cpp(274): error C4716: 'Monster::AddExperience' : must return a value
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========


I dont know about the JS game but none of your games looked very difficult.
All of them were old files when i was learning coding, and are no longer games I am working on anymore, from time to time I look back on them, to remember something i forgot and use it in my new program. (btw, the purpose of creating my new program is to compile everything i have learned in c++ into one project so It is easier to look back at in the future (well besides the maps, because there has to be a better way than that), as well as create a fun game for myself to play)

as for the Fighting Game, the errors you are seeing is that i accedently gave you the older version of the game (but doesn't matter as I no longer need it, except to use snidbits of it for help in my new project)

and MapFunctions.h is not needed, in the map files (old attempt to simplify them)

(The javascript one was when I was learning 3 new languages and stopped doing c++ for like 6-8 months, to learn them, and i had help on that project to learn them html5,css,javascript)

The last file i think called "NewProgram" or something similar, is the game i'm currently creating, and as of yesterday is no longer up to date, due to the tons of new weapons, armor, and shields added, and changed stats, as well as some new things for each (such as Weapon_Reload).
Last edited on
Topic archived. No new replies allowed.
Pages: 12