okay i try to compile this simple code in Dev C++ and i get some serious errorage
#include <iostream>
using namespace std;
int main()
{
char array[5][5] = {{'a','b','c','d','e'},
{'f','g','h','i','j'},
{'k','l','m','n','o'},
{'p','q','r','s','t'}
{'u','v','w','x','y'}};
cout << array[0,0] << endl;
cout << array[1,1] << endl;
cout << array[4,4] << endl;
cin >> array [3,3];
cout << array [3,3];
cin >> array [3,3];
return 0;
}
It giving me 2 parse errors (i have no idea what that is) on my array declaration (it's also giving me an assignment error there too), an "At global Scope" error for my file location and syntax errors for every one of my array calls. Whats the dealio? anyone have any ideas? This is just some test code for a much larger program that uses a big char array to play pong with, and i'm beating my head against a wall because it's due tomorrow at 1pm (oops).
2 1510
#include <iostream.h>
using namespace std;
int main()
{
char array[5][5] = {{'a','b','c','d','e'},
{'f','g','h','i','j'},
{'k','l','m','n','o'},
{'p','q','r','s','t'} <-- missing coma ","
{'u','v','w','x','y'}};
cout << array[0,0] << endl;
cout << array[1,1] << endl;
cout << array[4,4] << endl;
cin >> array [3,3];
cout << array [3,3];
cin >> array [3,3];
return 0;
}
what exactly you want to do?
#include <iostream.h>
using namespace std;
int main()
{
char array[5][5] = {{'a','b','c','d','e'},
{'f','g','h','i','j'},
{'k','l','m','n','o'},
{'p','q','r','s','t'} <-- missing coma ","
{'u','v','w','x','y'}};
cout << array[0,0] << endl;
cout << array[1,1] << endl;
cout << array[4,4] << endl;
cin >> array [3,3];
cout << array [3,3];
cin >> array [3,3];
return 0;
}
what exactly you want to do?
Actually i figured it out. The point of this program was just to debug and figure out the syntax i need for a bigger program (pong). I went through and i figured it out myself (except for the missing comma, thanks for that!). I was trying to access an element of the array by doing array[1,1] when actually i had to do array[1][1]. You see i'm making a 'gameboard' out of a large 2d char array and having the program move chars around in it to do pong (like it would move the char 'O' around in the array to change the location of the ball) and i wasn't getting anywhere. Now i see my problem *bonk head* thanks for the help though. I'll probably be posting later with other problems i run into tho >_<
Sign in to post your reply or Sign up for a free account.
Similar topics
by: Abby |
last post by:
From my code below, it will open a file specified in argv, then
read line by line and store each line in an array call IPTemp.
After reading until EOF, it will return array IPTemp to main, which...
|
by: John Smith |
last post by:
I have a two dimentional char array. Before filling it using
strtok(), I reset its elements to '\0' using two nested for loops.
The code works as I hope it would but I wonder whether I really
need...
|
by: rkmoray |
last post by:
I have created a Multi Dimentional array, but having problems filling
it.
int mCount=0;
mCount=ds.Tables.Rows.Count;
string arrayppsa = new string ;
DataTable myDataTable=ds.Tables;...
|
by: rkmoray |
last post by:
I have created a Multi Dimentional array, but having problems filling
it.
int mCount=0;
mCount=ds.Tables.Rows.Count;
string arrayppsa = new string ;
DataTable myDataTable=ds.Tables;...
|
by: Max M. Power |
last post by:
I'm getting an InvalidOperationException calling Invoke with a method
parameter object array that contains a two dimentional string array. More
stack trace output below:
// Create two...
|
by: ranjmis |
last post by:
Hi all,
Below is the code wherein I am initializing double dimentional array
inside main with string literals.
Now I want to display the strings using a function call to which I just
want to...
|
by: Icarus27 |
last post by:
Hello,
I am making a program that runs off of a two dimentional array but I have made it into a game called MouseBot. I am trying to make the game so that you can move the mouse until you get the...
|
by: Srinu |
last post by:
Hi All,
We know the following facts,
1. A two dimentional arrays in C is stored similar to a single
dimentional array.
2. * is the dereference operator that gives value at address denoted
by...
|
by: NvrBst |
last post by:
I'd like to do something like this but having a problem with the
proper syntax in the constructor, maybe someone knows the correct
syntax?
---MyClass.h---
#ifndef MYCLASS_H_
#define MYCLASS_H_...
|
by: Charles Arthur |
last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
|
by: emmanuelkatto |
last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud.
Please let me know.
Thanks!
Emmanuel
|
by: BarryA |
last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
|
by: Sonnysonu |
last post by:
This is the data of csv file
1 2 3
1 2 3
1 2 3
1 2 3
2 3
2 3
3
the lengths should be different i have to store the data by column-wise with in the specific length.
suppose the i have to...
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
|
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers,...
|
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome a new...
| |