Jump to content

Today in homework


mcdoga
 Share

Recommended Posts

wow reading code without indentation is painful, forum software pls step up ur game

yeah it looked like garbage so i got sad and though about seeing if code tags still work but instead i just decided to paste more code to make it look worse

Link to comment
Share on other sites

wow reading code without indentation is painful, forum software pls step up ur game

though about seeing if code tags still work but instead i just decided to paste more code to make it look worse

:(

I didn't recognize the language, but then again, I've only ever had pretty limited breadth in my programming. I will say, seeing a comment explaining why something was commented out kind of made me chuckle for some reason. I am not sure I have anything of substance to say about your work otherwise, though.

also as someone in education please do your homework we'll love you for it thank you

Can confirm. While it's easier on us when grading people who don't turn anything in, it always breaks my heart to give out zeroes. And grading work where they obviously didn't even try is only slightly less painful.
Link to comment
Share on other sites

:(

I didn't recognize the language, but then again, I've only ever had pretty limited breadth in my programming. I will say, seeing a comment explaining why something was commented out kind of made me chuckle for some reason. I am not sure I have anything of substance to say about your work otherwise, though.

Can confirm. While it's easier on us when grading people who don't turn anything in, it always breaks my heart to give out zeroes. And grading work where they obviously didn't even try is only slightly less painful.

and it also helps us get a sense of where you're at in the class so it can help us teach you better

it also makes us like you more if you show you're trying :')

Link to comment
Share on other sites

# runtime parameters:

# RCLSize determines how many nearest neighbors will be selected from at each stage of initial solution construction

# iterations determines how many independent trials will be run

# globalBest is an arbitrarily large number so it will be immediately replaced

RCLSize <- 3

iterations <- 10

globalBestSolutionObj <- 1000000

...

I had to do something like this freshman year. Wasn't strictly homework, but rather research. And my project was related to a dynamic, stochastic variant of TSP=sadness.

Link to comment
Share on other sites

very jealous. my school hasn't offered arabic in nearly 10 years. i have a textbook but no time.

as for homework, about 10 min ago i finished my lab report on the column density of hydrogen at the edge of the galaxy.

I also have a textbook but no time. because of arabic hw.

also I have more arabic to do. also algorithms homework.

Link to comment
Share on other sites

A homework thread huh...

Well, right now I have this pain in the neck:

//Evidencia 2: Sistema de Agendas

#include<iostream>
using namespace std;
int a,b,c,nombre; //Introducción de valores a utilizar
int main()
{
int agenda[a][6];
cout<<"Bienvenido al Sistema de Agendas."<<endl;
cout<<"Introduzca cantidad de registros a utilizar: ";
cin>>a;
for (b==0;b<=a-1;b++)
{
agenda[5] = 0;
}
do
{
cout<<"¿Qué acción desea hacer?"<<endl;
cout<<"1) Crear Agenda"<<endl;
cout<<"2) Altas"<<endl;
cout<<"3) Bajas"<<endl;
cout<<"4) Cambios"<<endl;
cout<<"5) Consultas"<<endl;
cout<<"6) Listado"<<endl;
cout<<"7) Fin"<<endl;
cout<<"Introduzca número: ";
cin>>c;//Menu para eligir acción a seguir
switch( c )
{
case(1):
{
for (b==0;b<=a-1;b++)
{
if (agenda[5]!=1 and agenda[5]!=2)
{
cout<<"Introduzca Nombre: ";
cin>>agenda[0];
cout<<"Introduzca Dirección: ";
cin>>agenda[1];
cout<<"Introduzca Teléfono: ";
cin>>agenda[2];
cout<<"Introduzca Fax: ";
cin>>agenda[3];
cout<<"Introduzca E-Mail: ";
cin>>agenda[4];
agenda[5] = 1;
break;
}
}
cout<<"Agenda llena."<<endl;
break;
}
case(2):
{
cout<<"Introduzca nombre a dar de alta: ";
cin>>nombre;
for (b==0;b<=a-1;b++)
{
if (agenda[0]==nombre)
{
agenda[5] = 2;
break;
}
}
cout<<"No es un nombre valido."<<endl;
break;
}
case(3):
{
cout<<"Introduzca nombre a dar de baja: ";
cin>>nombre;
for (b==0;b<=a-1;b++)
{
if (agenda[0]==nombre)
{
agenda[5] = 1;
break;
}
}
cout<<"No es un nombre valido."<<endl;
break;
}
case(4):
{
cout<<"Introduzca nombre de registro a modificar: ";
cin>>nombre;
for (b==0;b<=a-1;b++)
{
if (agenda[0]==nombre)
{
cout<<"Introduzca nuevo Nombre: ";
cin>>agenda[0];
cout<<"Introduzca nueva Dirección: ";
cin>>agenda[1];
cout<<"Introduzca nuevo Teléfono: ";
cin>>agenda[2];
cout<<"Introduzca nuevo Fax: ";
cin>>agenda[3];
cout<<"Introduzca nuevo E-Mail: ";
cin>>agenda[4];
break;
}
}
cout<<"No es un nombre valido."<<endl;
break;
}
case(5):
{
cout<<"Introduzca nombre de registro a consultar: ";
cin>>nombre;
for (b==0;b<=a-1;b++)
{
if (agenda[0]==nombre)
{
cout<<"Nombre: ";
cout<<""<<agenda[0]<<endl;
cout<<"Dirección: ";
cout<<""<<agenda[1]<<endl;
cout<<"Teléfono: ";
cout<<""<<agenda[2]<<endl;
cout<<"Fax: ";
cout<<""<<agenda[3]<<endl;
cout<<"E-Mail: ";
cout<<""<<agenda[4]<<endl;
cout<<"Condición: ";
if (agenda[5]==1)
{
cout<<"Baja"<<endl;
}
if (agenda[5]==2)
{
cout<<"Alta"<<endl;
}
break;
}
}
cout<<"No es un nombre valido."<<endl;
break;
}
case(6):
{
cout<<"Listado de Agenda"<<endl;
cout<<"Nombre Dirección Teléfono Fax E-Mail"<<endl;
cout<<"--------------------------------------------------------------------------------------------"<<endl;
for (b==0;b<=a-1;b++)
{
if (agenda[5]==2)
{
cout<<""<<agenda[0];
cout<<" ";
cout<<""<<agenda[1];
cout<<" ";
cout<<""<<agenda[2];
cout<<" ";
cout<<""<<agenda[3];
cout<<" ";
cout<<""<<agenda[4];
}
}
break;
}
case(7):
{
cout<<"Fin del programa."<<endl;
break;
}
default:
{
cout<<"Introduzca un número valido."<<endl;
}
}
} while (b!=7);
system("pause");
}

Could translate the Spanish but...

I don't even know what's wrong with it. The stuff inside the Switch-Case is wrong somehow...

Link to comment
Share on other sites

A homework thread huh...

Well, right now I have this pain in the neck:

//Evidencia 2: Sistema de Agendas
#include<iostream>
 
using namespace std;
 
int a,b,c,nombre; //Introducción de valores a utilizar
 
int main()
{
  int agenda[a][6];
  cout<<"Bienvenido al Sistema de Agendas."<<endl;
  cout<<"Introduzca cantidad de registros a utilizar: ";
  cin>>a;
  for (b==0;b<=a-1;b++)
  {
    agenda[b][5] = 0;
  }
  do
  {
    cout<<"¿Qué acción desea hacer?"<<endl;
    cout<<"1) Crear Agenda"<<endl;
    cout<<"2) Altas"<<endl;
    cout<<"3) Bajas"<<endl;
    cout<<"4) Cambios"<<endl;
    cout<<"5) Consultas"<<endl;
    cout<<"6) Listado"<<endl;
    cout<<"7) Fin"<<endl;
    cout<<"Introduzca número: ";
    cin>>c;//Menu para eligir acción a seguir
    switch( c )
    {
      case(1):
      {
        for (b==0;b<=a-1;b++)
        {
          if (agenda[b][5]!=1 and agenda[b][5]!=2)
          {
            cout<<"Introduzca Nombre: ";
            cin>>agenda[b][0];
            cout<<"Introduzca Dirección: ";
            cin>>agenda[b][1];
            cout<<"Introduzca Teléfono: ";
            cin>>agenda[b][2];
            cout<<"Introduzca Fax: ";
            cin>>agenda[b][3];
            cout<<"Introduzca E-Mail: ";
            cin>>agenda[b][4];
            agenda[b][5] = 1;
            break;
          }
        }
        cout<<"Agenda llena."<<endl;
        break;
      }
      case(2):
      {
        cout<<"Introduzca nombre a dar de alta: ";
        cin>>nombre;
        for (b==0;b<=a-1;b++)
        {
          if (agenda[b][0]==nombre)
          {
            agenda[b][5] = 2;
            break;
          }
        }
        cout<<"No es un nombre valido."<<endl;
        break;
      }
      case(3):
      {
        cout<<"Introduzca nombre a dar de baja: ";
        cin>>nombre;
        for (b==0;b<=a-1;b++)
        {
          if (agenda[b][0]==nombre)
          {
            agenda[b][5] = 1;
            break;
          }
        }
        cout<<"No es un nombre valido."<<endl;
        break;
      }
      case(4):
      {
        cout<<"Introduzca nombre de registro a modificar: ";
        cin>>nombre;
        for (b==0;b<=a-1;b++)
        {
          if (agenda[b][0]==nombre)
          {
            cout<<"Introduzca nuevo Nombre: ";
            cin>>agenda[b][0];
            cout<<"Introduzca nueva Dirección: ";
            cin>>agenda[b][1];
            cout<<"Introduzca nuevo Teléfono: ";
            cin>>agenda[b][2];
            cout<<"Introduzca nuevo Fax: ";
            cin>>agenda[b][3];
            cout<<"Introduzca nuevo E-Mail: ";
            cin>>agenda[b][4];
            break;
          }
        }
        cout<<"No es un nombre valido."<<endl;
        break;
      }
      case(5):
      {
        cout<<"Introduzca nombre de registro a consultar: ";
        cin>>nombre;
        for (b==0;b<=a-1;b++)
        {
          if (agenda[b][0]==nombre)
          {
            cout<<"Nombre: ";
            cout<<""<<agenda[b][0]<<endl;
            cout<<"Dirección: ";
            cout<<""<<agenda[b][1]<<endl;
            cout<<"Teléfono: ";
            cout<<""<<agenda[b][2]<<endl;
            cout<<"Fax: ";
            cout<<""<<agenda[b][3]<<endl;
            cout<<"E-Mail: ";
            cout<<""<<agenda[b][4]<<endl;
            cout<<"Condición: ";
            if (agenda[b][5]==1)
            {
              cout<<"Baja"<<endl;
            }
            if (agenda[b][5]==2)
            {
              cout<<"Alta"<<endl;
            }
            break;
          }
        }
        cout<<"No es un nombre valido."<<endl;
        break;
      }
      case(6):
      {
        cout<<"Listado de Agenda"<<endl;
        cout<<"Nombre          Dirección                              Teléfono          Fax          E-Mail"<<endl;
        cout<<"--------------------------------------------------------------------------------------------"<<endl;
        for (b==0;b<=a-1;b++)
        {
          if (agenda[b][5]==2)
          {
            cout<<""<<agenda[b][0];
            cout<<" ";
            cout<<""<<agenda[b][1];
            cout<<" ";
            cout<<""<<agenda[b][2];
            cout<<" ";
            cout<<""<<agenda[b][3];
            cout<<" ";
            cout<<""<<agenda[b][4];
          }
        }
        break;
      }
      case(7):
      {
        cout<<"Fin del programa."<<endl;
        break;
      }
      default:
      {
        cout<<"Introduzca un número valido."<<endl;
      }
    }
  } while (b!=7);
  system("pause");
}

Could translate the Spanish but...

I don't even know what's wrong with it. The stuff inside the Switch-Case is wrong somehow...

ok let's go
  • why are you using global vars?
  • using namespace std; is bad practice but I can appreciate you being lazy so w/e
  • int agenda[a][6]; the a here is uninitialized, you're asking for trouble. You probably want to cin >> a; before your first for loop.

  • your for loop uses a logical equality operation ( b==0 ) rather than an assignment ( b = 0 )

Your switch statement doesn't work because of all the for (b==0;b<=a-1;b++) things you have going on.

Not sure what you're going for with agenda[n][5]; it looks like a control flag but there's no way to modify it.

You should probably comment your code more (not that I could understand the language anyways) and also use more descriptive variable names. Like, int num_entries instead of int a (since it looks like a is the number of rows of your array?).

EDIT: also use

[code]your code here[ /code]
tags for code. See inside the spoiler in the quote.

XzRLaWp.png

Edited by Euklyd
Link to comment
Share on other sites

ok let's go

  • why are you using global vars?
  • using namespace std; is bad practice but I can appreciate you being lazy so w/e
  • int agenda[a][6]; the a here is uninitialized, you're asking for trouble. You probably want to cin >> a; before your first for loop.

  • your for loop uses a logical equality operation ( b==0 ) rather than an assignment ( b = 0 )

Your switch statement doesn't work because of all the for (b==0;b<=a-1;b++) things you have going on.

Not sure what you're going for with agenda[n][5]; it looks like a control flag but there's no way to modify it.

You should probably comment your code more (not that I could understand the language anyways) and also use more descriptive variable names. Like, int num_entries instead of int a (since it looks like a is the number of rows of your array?).

What's a global var?

Using namespace std is lazy? That's how we're being taught.

There is a cin for the a three lines below it. Or should it go before the int?

Ah, I see, so for's don't need double = then?

It was meant to be like a chart-like thing, but it's more likely not the way to do it, if it needs letter-based entries (I would guess the numbers in the brackets indicate the number of characters, and stuff with letters would need way over what I put). Well, to modify that's what the commands in the switch-case are for. Or if you mean just the sixth column, then it's for a value to check whenever it's possible to use for the other switch-case comands.

Edited by Acacia Sgt
Link to comment
Share on other sites

What's a global var?

Using namespace std is lazy? That's how we're being taught.

There is a cin for the a three lines below it. Or should it go before the int?

Ah, I see, so for's don't need double = then?

It was meant to be like a chart-like thing, but it's more likely not the way to do it, if it needs letter-based entries (I would guess the numbers in the brackets indicate the number of characters, and stuff with letters would need way over what I put). Well, to modify that's what the commands in the switch-case are for. Or if you mean just the sixth column, then it's for a value to check whenever it's possible to use for the other switch-case comands.

1) global variables are variables in the global namespace. in this case, variables outside of main() or other functions.

2) if you're being taught that way it doesn't reeaaaally matter, but it is good practice to do std::cout and whatnot each time rather than using namespace std; Balcerzak has an explanation here but there are also more thorough explanations if you google it.

3) == is used to compare two things, which is not what you want in the first part of a for loop. for the first part, what it's doing is setting your counter equal to zero at the beginning (or, in theory, some other number), so you'd use =.

4) I was just talking about the sixth column.

EDIT: missed the thing about cin. You should do like,

...

int a,b,c,nombre; //Introducción de valores a utilizar
 
cout<<"Bienvenido al Sistema de Agendas."<<endl;
cout<<"Introduzca cantidad de registros a utilizar: ";
cin>>a;

int agenda[a][6];

...

as it is you don't know the value of a when you're declaring the size of agenda

Edited by Euklyd
Link to comment
Share on other sites

i need to learn some C sometime

fwiw this is C++, but regardless basic C is pretty straightfoward to pick up imo

that being said I thought you already knew it? what language(s) is it that you do know?

Link to comment
Share on other sites

1) global variables are variables in the global namespace. in this case, variables outside of main() or other functions.

2) if you're being taught that way it doesn't reeaaaally matter, but it is good practice to do std::cout and whatnot each time rather than using namespace std; Balcerzak has an explanation here but there are also more thorough explanations if you google it.

3) == is used to compare two things, which is not what you want in the first part of a for loop. for the first part, what it's doing is setting your counter equal to zero at the beginning (or, in theory, some other number), so you'd use =.

4) I was just talking about the sixth column.

EDIT: missed the thing about cin. You should do like,

...

int a,b,c,nombre; //Introducción de valores a utilizar
 
cout<<"Bienvenido al Sistema de Agendas."<<endl;
cout<<"Introduzca cantidad de registros a utilizar: ";
cin>>a;

int agenda[a][6];

...

as it is you don't know the value of a when you're declaring the size of agenda

1) I see.

2) Oh. Well, at least for this class I have to stick with it, though.

3) Man, I can't believe I forgot it doesn't need double =. Gets to show how the frustration made me forget about it.

4) Ah, that column is for a value that would later be checked to see if each action in the switch-case would follow or not.

Okay, so the cin goes before the int, not after.

Well, considering how pretty much no one got the program working, the teacher has put it on hold while we deal with other stuff. Considering we still have to do this one... ah well, gotta focus first on what I can do.

Link to comment
Share on other sites

Well, considering how pretty much no one got the program working, the teacher has put it on hold while we deal with other stuff. Considering we still have to do this one... ah well, gotta focus first on what I can do.

I think I got the program working with the minor edits I mentioned, but I wasn't able to check output because of the print function requiring the sixth column to be something else. (I've since messed around with it and hacked my way in, idk what you're going for tho so my way probably won't fulfill your assignment specs.)

also the termination condition of your do ... while () loop should be while (c!=7); instead of checking b; c is the menu selection variable.

Also also in between printing rows you need to print out an std::endl or a newline ( '\n' ) or something.

Also also also in this line:

cout<<""<<agenda[4];

the "" is irrelevant / unnecessary. To make things consistent widths you should use <iomanip> stuff, but idk if you learned that yet.

[spoiler=with <iomanip> you can do stuff like]

// I changed this so I didn't have to worry about the sixth column
//                    if (agenda[b][5]==2)
                    if (true)
                    {
                        cout<< left << setw(16) << agenda[b][0];
                        cout<< setw(39) << agenda[b][1];
                        cout<< setw(18) << agenda[b][2];
                        cout<< setw(13) << agenda[b][3];
                        cout<< agenda[b][4];
                        cout<<"\n"<<flush;
                    }
obviously don't try to use <iomanip> unless you've learnt it in-class, or talked to your teacher.

At the very least, cases 1 and 6 are very close to working.

Link to comment
Share on other sites

  • 2 weeks later...

(i don't actually need help but thanks to anyone who was going to)

wasn't gonna help but since you don't need it I will

what's ur thesis

Link to comment
Share on other sites

I have an Agricultural Science project to work on where I have to make a presentation about crop rotation. I also have to learn all the different terms for farm animals (there is like 8 different names for "bovines" aka cows)

Link to comment
Share on other sites

I spent 6+ hours doing Duolingo lessons cause i had to finish a fuck ton of skills to do before midnight. I finished at 11, and it's such a relief. I even asked to be kicked from chats so I wouldn't be distracted.

So glad Spanish 3 isn't a required course at my HS.

Link to comment
Share on other sites

I spent 6+ hours doing Duolingo lessons cause i had to finish a fuck ton of skills to do before midnight. I finished at 11, and it's such a relief. I even asked to be kicked from chats so I wouldn't be distracted.

So glad Spanish 3 isn't a required course at my HS.

omg Duolingo

I have to use that sometimes for German and Irish. I have messages on there from Angela Merkel telling me to fight her on Duolingo and that I can't keep up with her xp level.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...