[QUOTE=IndieGamer;34884175]Whats an identifier it's an error i have.
int = age;
The = has a line under it for the error.[/QUOTE]
It should be either:
[csharp]int age;[/csharp]
Or:
[csharp] int nameOfInt = age;[/csharp]
Depending on if you're trying to declare age as variable or assign age to a variable.
-fuck-
[QUOTE=starbug;34884189]int age;[/QUOTE]
Ok.
[editline]26th February 2012[/editline]
[QUOTE=MrTilepy;34884195]It should be either:
[csharp]int age;[/csharp]
Or:
[csharp] int nameOfInt = age;[/csharp]
Depending on if you're trying to declare age as variable or assign age to a variable.[/QUOTE]
Ok.
[editline]26th February 2012[/editline]
int age;
Console.WriteLine("age * 100");
I can't get age to times by 100.
[QUOTE=Kepler;34883799][IMG]http://i.imgur.com/6klMm.png[/IMG]
This is transparent. Help[/QUOTE]
I spent a good while trying to get visual studio to let me do this. I couldn't find a way, except using a gif. Yep.
[QUOTE=IndieGamer;34884343]Ok.
[editline]26th February 2012[/editline]
Ok.
[editline]26th February 2012[/editline]
int age;
Console.WriteLine("age * 100");
I can't get age to times by 100.[/QUOTE]
Dont use quotes or it treates it like a string
[QUOTE=IndieGamer;34884343]Ok.
[editline]26th February 2012[/editline]
Drop the quotes in console.writeline
Ok.
[editline]26th February 2012[/editline]
int age;
Console.WriteLine("age * 100");
I can't get age to times by 100.[/QUOTE]
Also, make sure you assign age to something.
[QUOTE=WTF Nuke;34886015]Also, make sure you assign age to something.[/QUOTE]
IIRC C# automatically assigns it to 0
[QUOTE=Richy19;34886146]IIRC C# automatically assigns it to 0[/QUOTE]
You should never rely on this, though.
Because if you ever get to C and do that you'll either segfault or get garbage numbers from memory
Is it [B][url=http://en.wikipedia.org/wiki/Undefined_behavior]Undefined Behavior[/url][/B], and thus you can't be certain it will always be assigned the default value?
Then whats the point of doing 0*100?
[QUOTE=BlkDucky;34886203]You should never rely on this, though.[/QUOTE]
the C# standard guarantees all variables are automatically initialized to default(T).
default(int) is 0
Not sure if this is a good place for this, but it seems like...
Anyway, I need a small project to work on so I can get better.
I know C++ semi decently and I am learning Java.
So ya, if someone could give me an idea of a small program to make that would be greatly appreciated. =]
[QUOTE=Pangogie;34890586]Not sure if this is a good place for this, but it seems like...
Anyway, I need a small project to work on so I can get better.
I know C++ semi decently and I am learning Java.
So ya, if someone could give me an idea of a small program to make that would be greatly appreciated. =][/QUOTE]
It might be an idea to make a thread for this, I find myself asking similar questions a lot. But here's a few ideas that may be of help to you:
Temperature converter (not just Fahrenheit\Celsius but also Kelvin, Rankine, anything else you can think of)
Unit converter (eg metres to yards, decades to days, whatever)
Basic calculator
Caesar (letter-shift) cipher
Other types of basic ciphers
Numeric base converter (eg 10 in base 16 == 16 in base 10 == 20 in base 8 == 10000 in base 2)
[QUOTE=swift and shift;34890565]the C# standard guarantees all variables are automatically initialized to default(T).
default(int) is 0[/QUOTE]
Even so, I don't think it's particularly clear code. You should still explicitly set it to 0.
[QUOTE=mechanarchy;34891593]It might be an idea to make a thread for this, I find myself asking similar questions a lot. But here's a few ideas that may be of help to you:
Temperature converter (not just Fahrenheit\Celsius but also Kelvin, Rankine, anything else you can think of)
Unit converter (eg metres to yards, decades to days, whatever)
Basic calculator
Caesar (letter-shift) cipher
Other types of basic ciphers
Numeric base converter (eg 10 in base 16 == 16 in base 10 == 20 in base 8 == 10000 in base 2)[/QUOTE]
A good Java project to help you learn it and the swing library is to make a basic banking management program (income/expenditure/balance). Its what I did when learning Java.
I'm creating my own url protocol in c++ ( "http://" , "svn://" , those types of things ). Except when i get an argument , it only returns the first letter of the argument. Could anyone help?
code:
[code]
// Alert.cpp : Defines the entry point for the console application.
//
#include "stdafx.h"
#include <iostream>
#include <string>
using namespace std;
int _tmain(int argc, char* argv[])
{
int count = 0;
cout << "Alert.exe invoked." << argc << " Arguments placed\r\n";
cout << "The following arguments were used:\n";
//cout << "\t" << argv[0] << "\n";
for (int nArg=0; nArg < argc; nArg++)
cout << "\t" << nArg << "\t" << argv[nArg] << endl;
cout <<"\nPress any key to continue...";
cin >> count;
return 0;
}
[/code]
stripped all the information passing stuff
I'm trying to make a loadmap, but it isn't working, the position is working, but the texture isn't, and I could use some help, do you guys see any flaws?
[cpp] public void loadMap()
{
if (File.Exists("map.txt"))
{
Console.WriteLine("File Exists, going on!");
TextReader reader = new StreamReader("map.txt");
Console.WriteLine("Reader made, going on!");
String count = reader.ReadLine();
int countN = Convert.ToInt32(count);
Console.WriteLine("Read the count, going on!");
for (int i = 0; i < countN; i++)
{
Console.WriteLine("STARTED FORLOOP");
String textureName = reader.ReadLine();
String texturePosX = reader.ReadLine();
String texturePosY = reader.ReadLine();
int texturePosXN = Convert.ToInt32(texturePosX);
int texturePosYN = Convert.ToInt32(texturePosY);
Console.WriteLine("READ INFORMATION" + textureName);
Texture2D textureUsing = groundT;
if (textureName == "GROUND1")
{
textureUsing = ground2T;
}
if (textureName == "GROUND2")
{
textureUsing = groundT;
}
if (textureName == "GROUND3")
{
textureUsing = ground3T;
}
if (textureName == "GRASS1")
{
RogueTexture newTile = new RogueTexture(grassT, new Vector2(texturePosXN, texturePosYN));
mapTiles.Add(newTile);
}
if (textureName == "GRASSFLOWER1")
{
textureUsing = grassFlowerT;
}
if (textureName == "SAND1")
{
textureUsing = sandT;
}
if (textureName == "TREE1")
{
textureUsing = treeT;
}
if (textureName == "WALLBOTTOM1")
{
textureUsing = wallBottomT;
}
if (textureName == "WALLTOP1")
{
textureUsing = wallTopT;
}
Console.WriteLine("TEXTURE IS " + textureUsing.Name);
Console.WriteLine("CREATED TILE.");
}
reader.Close();
}
else
{
TextWriter writer = new StreamWriter("map.txt");
writer.Close();
}
}[/cpp]
Can someone give me pointers( not NULL ) on how to improve my GUI a bit ?
[img]http://dl.dropbox.com/u/408914/Debug/facepunch.JPG[/img]
[QUOTE=Staneh;34894005]I'm trying to make a loadmap, but it isn't working, the position is working, but the texture isn't, and I could use some help, do you guys see any flaws?
-code-[/QUOTE]
I could be wrong but should line 22 read:
[csharp]
Texture2D textureUsing = new Texture2D(groundT);
[/csharp]
[QUOTE=James xX;34893960]I'm creating my own url protocol in c++ ( "http://" , "svn://" , those types of things ). Except when i get an argument , it only returns the first letter of the argument. Could anyone help?[/QUOTE]
Sounds like it's in UTF-16 (wchars).
Does anyone have an experience with C++ directx and shaders? Need some help generally implementing them.
A few days back I asked about a C# function running slow with SFML.
Well i ran a benchmark to test it out and this is the output, copied from my post on the SFML forum:
[QUOTE]Just made a benchmark to test it out.
The C# code is:
[code]public static void Main (string[] args)
{
RenderWindow window = new RenderWindow(new SFML.Window.VideoMode(800,600), "SFML TEST");
Sprite spr = new Sprite(new Texture("img.png") );
int startTime = 0;
int delta = 0;
int i = 111; //have an int to turn it into a string as the delta would be
for(int a = 0; a < 10; a++)
{
startTime = Environment.TickCount;
window.SetActive();
window.Clear(SFML.Graphics.Color.White);
window.Draw(spr);
window.Draw(new SFML.Graphics.Text( i + " ms", SFML.Graphics.Font.DefaultFont, 12));
// Finally, display the rendered frame on screen
window.Display();
delta += (Environment.TickCount - startTime);
}
window.Close();
Console.WriteLine("Average in 10 runs is: " + (delta/10.0f) );
//Average output is around 79-80
}[/code]
With an average frame taking 79 to 80 ms to clear, draw an 800x600 image, draw the time & display it.
And C++ takes around the same to do the same... (well around 76 ms) So I guess my program is just because of the vertex array then.
Oh well Im ok with that I guess :)
On any decent computer it should run pretty fast.
The C++ code btw is:
[code]#include <SFML/Graphics.hpp>
#include <iostream>
#include <sstream>
int main()
{
sf::Clock clock;
sf::Int32 delta = 0;
sf::RenderWindow App;
App.Create( sf::VideoMode(800,600,32), "Window");
sf::Sprite spr;
sf::Texture tex;
tex.LoadFromFile("img.png");
spr.SetTexture(tex);
for(int i = 0; i < 10; i++)
{
clock.Restart().AsMilliseconds();
App.SetActive();
App.Clear(sf::Color::Black);
App.Draw(spr);
std::stringstream ss;
ss << delta << " ms" << std::endl;
sf::Text text( ss.str() );
App.Draw(text);
App.Display();
delta += clock.Restart().AsMilliseconds();
}
std::cout << (delta/10.0f) << std::endl;
}
[/code]
And the image I used is: [url]http://i.imgur.com/UW5pm.jpg[/url][/QUOTE]
So turns out it is just my craptop drivers and not Mono its self
[QUOTE=MrTilepy;34896579]I could be wrong but should line 22 read:
[csharp]
Texture2D textureUsing = new Texture2D(groundT);
[/csharp][/QUOTE]
No, I am not making a new texture, I am using an already loaded texture.
[QUOTE=marcin1337;34896068]Can someone give me pointers( not NULL ) on how to improve my GUI a bit ?
[IMG]http://dl.dropbox.com/u/408914/Debug/facepunch.JPG[/IMG][/QUOTE]
Selection box is a little dark.
The grey rows could also be a little lighter
The column headers could use some colour, perhaps a lightish blue?
Just started C and I am trying to output a txt file counting numbers downward. I am not sure where I concatenate an \n and whether or not itoa is the right way to go about doing this?
[code]
#include <stdio.h>
#include <stdlib.h>
int main()
{
FILE *lol = fopen("c:\\test.txt", "w");
if (lol)
{
int i = 1;
for(;i<999;i++)
{
char buffer[5];
size_t len = 0;
itoa(i, buffer, 10);
len = strlen(buffer);
fwrite(buffer, len, 1, lol);
}
fclose(lol);
}
}
[/code]
Also a bit confused with the buffer.
You probably want to use fprintf() instead of fwrite(). That's meant for text output, and uses a format string, so you can do
[code]
fprintf(lol, "%s\n", buffer);
[/code]
You could even skip the itoa() call and do
[code]
fprintf(lol, "%d\n", i);
[/code]
fwrite() is meant for writing to binary files, where you just want to output raw bytes without any formatting.
That buffer, btw, is just a temporary string used to hold the characters that itoa() produces.
Thanks for the info but I had originally tried fprintf, but the output crashes on run?
EDIT: With skipping itoa, is that because "lol" isn't specified?
EDIT2:
Got it working!
[code]
#include <stdio.h>
int main()
{
FILE *lol = fopen("c:\\test.txt", "w");
if (lol)
{
int i = 1;
for(;i<999;i++)
{
fprintf(lol, "%d\n", i);
}
fclose(lol);
}
}
[/code]
Thanks again!
Oops, yes, that should've been lol, not buffer, in the first argument to the second fprintf(). Fixed.
Now that you're using printf's "%d" to format the integer directly, you don't need that buffer variable at all.
Sorry, you need to Log In to post a reply to this thread.