why there are weird symbol in my output? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

why there are weird symbol in my output?

#include<stdio.h> int main(){ char nama[10]; float telp[8]; char nama2[10]; float telp2[8]; char nama3[10]; float telp3[8]; scanf("%[^0-9]s%[^a-z,A-Z]f%[^0-9]s%[^a-z,A-Z]f%[^0-9]s%[^a-z,A-Z]f", nama, telp, nama2, telp2, nama3, telp3); printf ("%-10s %8f\n%-10s %8f\n%-10s %8f\n", nama, telp, nama2, telp2, nama3, telp3); return 0; } from this coding, i don't know why i get weird symbol in the output. can anyone help me please? T^T

5th Oct 2018, 10:31 AM
chiyo Arase
chiyo Arase - avatar
1 Answer
0
What is your code supposed to do? Looks like you're trying to format the input using regular expressions, but that's not how things work. Also, the telp variables are declared as arrays of floats, but you're trying to fill them with single values (and you don't use the reference operator & in scanf). Btw, looking at your C++ tag, this looks more like C to me, but you probably can run it in a C++ compiler too
5th Oct 2018, 12:21 PM
Anna
Anna - avatar