#Current Project

58 messages ยท Page 1 of 1 (latest)

steep craneBOT
#

When your question is answered use !solved to mark the question as resolved.

Remember to ask specific questions, provide necessary details, and reduce your question to its simplest form. For tips on how to ask a good question use !howto ask.

scarlet depot
#

so a few things

steep craneBOT
#
Why Is `using namespace std` Considered Bad Practice?

using namespace std will import all the symbols from std into the enclosing namespace. This can easily lead to name collisions, as the standard library is filled with common names: get, count, map, array, etc.

A key concern with using namespace std; is not what is imported now but rather what may suddenly be imported in the future.

While using namespace std; is alright for tiny projects, it is important to move away from it as soon as possible. Consider less intrusive alternatives:

// OK: *only* import std::vector
using std::vector;
// OK: namespace alias
namespace chr = std::chrono;
chr::duration x;
cedar hare
#

oh yes, i have to lol

#

i know its bad practice, and my prof even said it is, but we have to use namespace std

scarlet depot
#

alright

#

do you get errors, or do you get an unexpected/incorrect output or behavior

cedar hare
#

unexpected/incorrect output

scarlet depot
#

did you try to use a debugger?

cedar hare
#

i have to run it through this autograder which checks it through files and thats the picture where i showed the hints

#

no how do i do that ๐Ÿ˜…

scarlet depot
#

only the autograder?

#

( a debugger allows you to run your code line by line

cedar hare
scarlet depot
#

okay

cedar hare
#

but like when ive been running it

#

i get this error

scarlet depot
#

so you have a debugger iirc
you can add breakpoints in your code by clicking next to the line numbers for sure

#

and then a red play button starts the debugger

#

but i didnt use C::B for like 4 years so i dont really remember

#

but I'd highly suggest switching to Visual Studio (not Visual Studio Code)

cedar hare
#

do i have to pay for it

#

ill do it, i just get taught on c::b so its like just convenient

scarlet depot
#

no

#

Visual Studo Community is free

#

but if you have a university microsoft login u might get a free Enterprise version with that

cedar hare
#

oki, is this to help me debug it?

scarlet depot
#

its much easier to help with Visual Studio as it's used more than CB

cedar hare
#

oki doki

#

can i just paste my code there

scarlet depot
#

yes

cedar hare
#

which one should i download like the workload

#

i just see 3 with c++

#

im assuming universal development but ima download all 3

scarlet depot
#

all

cedar hare
#

this is on university wifi im sorry its taking forever LOL

cedar hare
#

oki doki i got it all downloaded

#

which one should i use

#

oh i got it

#

ok ima past my code now

#

okay so im getting different errors with this code

scarlet depot
#

ye

#

cuz u dont have the file in there

#

copy it

#

into the same dir as the source

cedar hare
#

i do tho i imported all my files

civic badger
# cedar hare

It's saying miscelainious files, which IIRC happens when you dont create a new application. To use it you have to create a new console application.

Also, since it's a pretty small application with only 3 files that I can see, you can also try copy pasting to OnlineGDB (max: 3 files): https://onlinegdb.com/qBfWYO5TO

VS is a lot better than onlinegdb, but the latter is easier to share a pre-made setup

cedar hare
civic badger
cedar hare
#

oooooh oki doki

lusty stump
#

I want to learn c
From where should I learn?

steep craneBOT
#

Thank you and let us know if you have any more questions!

This thread is now set to auto-hide after an hour of inactivity